文章詳情頁
為什么return不了數(shù)據(jù)給ajax
瀏覽:119日期:2022-06-06 16:15:27
問題描述
if (Request::isAjax()) { $data = Request::except('password_confirm', 'post'); if (is_object(UserModel::create($data))) { return ['status' => 1, 'message' => '恭喜注冊成功']; } else {return ['status' => 0, 'message' => '注冊失敗']; }}else{ return $this->error("請求類型錯(cuò)誤", 'register');}
問題解答
回答1:$ret = array( ’status’ => 1, ’message’ => ’恭喜注冊成功’);echo json_encode($ret);die;回答2:改成json格式,你返回的數(shù)組js不認(rèn)
上一條:循環(huán)得到的數(shù)據(jù)怎么array_push到一個(gè)大數(shù)組中下一條:PhpStudy集成環(huán)境如何降低MySQL數(shù)據(jù)庫版本?
相關(guān)文章:
1. css3 - [CSS] 動(dòng)畫效果 3D翻轉(zhuǎn)bug2. python - Django分頁和查詢參數(shù)的問題3. javascript - 百度echarts series數(shù)據(jù)更新問題4. MySQL客戶端吃掉了SQL注解?5. javascript - JS設(shè)置Video視頻對象的currentTime時(shí)出現(xiàn)了問題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...6. php自學(xué)從哪里開始?7. python小白的基礎(chǔ)問題 關(guān)于while循環(huán)的嵌套8. 求大神幫我看看是哪里寫錯(cuò)了 感謝細(xì)心解答9. phpstady在win10上運(yùn)行10. javascript - 圖片能在網(wǎng)站顯示,但控制臺(tái)仍舊報(bào)錯(cuò)403 (Forbidden)
排行榜

熱門標(biāo)簽