首頁  >  問答  >  主體

我填寫的提交地址是checkLogin為什麼提交的是index

為什麼要幫我一個這樣的錯誤

[0] HttpException in App.php line 590

方法不存在:app\index\ controller\User->index()

程式碼如下:

$(function () {
  $('#loginbtn').on('click', function (event) {
     $.ajax({
        type:'POST',//設定提交資料的請求方法
        url:"{:url('ckeckLogin')}"///url資料提交路徑
        data:$('form').serialize(),//將表單資料序列化以後提交
        dataType:'json',
         dataType:'json',
       success:function為PHP中對應方法return的Map集合,以json方式傳過來
           alert(JSON.stringify(data));
#               }
#              

#

你哟你哟2392 天前1566

全部回覆(4)我來回復

  • 轻微强迫症

    轻微强迫症2018-05-24 20:52:10

    url不是提交到User.php裡的checkLogin方法嗎,為什麼原始程式碼變成了/index.php/index/user/checklogin.html檔

    5GGMB$FM]VU3XA@%ZS~VK_S.jpg

    #

    回覆
    0
  • 你哟

    你哟2018-03-07 12:41:24

    查看網頁原始碼是沒錯的啊!

    $(function () {    

    $('#loginbtn').on('click',function (event) {    

    $.ajax({    

    type:'POST',//設定提交資料的請求方法   

    #url:"/index.php/index/user/checklogin.html",//設定資料提交路徑   

    # data:$('form').serialize(),//將表單資料序列化以後提交   

    dataType:'json',    

    success:function (data)   

    });    

    })    

    })     


    回覆
    0
  • 换个网名

    你可以在url:寫實際的地址 再看跳轉的url是不是對的?

    换个网名 · 2018-03-07 12:50:33
    你哟

    我已經解決了,沒有清除那個button的submit

    你哟 · 2018-03-07 15:11:55
  • 取消回覆