<script type="text/javascript">
? ?$(function(){
? ? ? ?$('#register').on('click',function(){
? ? ? ? ? ?//用ajax提交用戶信息
? ? ? ? ? ?$. ajax({
? ? ? ? ? ? ? ?type: 'post',
? ? ? ? ? ? ? ?url: "{:url('insert')}",
? ? ? ? ? ? ? ?data: $('#login').serialize(),
? ? ? ? ? ? ? ?dataType: 'json',
? ? ? ? ? ? ? ?Erfolg: function(data)
? ? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ? ?alert('成功了');
? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?error: function(data)
? ? ?? ? ? ? ?{
? ? ? ? ? ? ? ? ? ?alert(data.message);
? ? ? ? ? ? ? ?}
? ? ? ? ? ?})
? ? ? ?})
? ?})
</ Skript & gt;
后臺(tái) : :
Public Function Insert ()
{
if (request :: isajax ()) {
$ data = request :: au?er ('Passwort_confirm', 'post');
wenn (UserModel::create($data))
? ? ? ?{
? ? ? ? ? ?return ['status'=>1,'message'=>'注冊(cè)成功'];
? ? ? ?}else{
? ? ? ? ? ?return ['message'=>'操作失敗','status'=>0];
? ? ? ?}
? ?}else{
? ? ? ?$this->error('請(qǐng)求類型錯(cuò)誤','register');
? ?}
}
我也遇到這種情況,后來發(fā)現(xiàn)跟瀏覽器有關(guān),開始用的火狐不行,換了谷歌就ok了
database調(diào)試打開,app調(diào)試打開。直接到insert頁面查看問題。創(chuàng)建一個(gè)test控制器,寫一個(gè)data數(shù)組create一下。