Using Ajax and returning json array in laravel 5

后端 未结 6 587
粉色の甜心
粉色の甜心 2021-01-02 05:27

\"enterI am new to \"AJAX\" and I have been trying to send a request \"ONSELECT\" using \"AJAX

6条回答
  •  粉色の甜心
    2021-01-02 05:42

    Add error callback to your ajax request to find if an error is thrown,

    $.ajax({
      type    :"POST",
      url     :"http://localhost/laravel/public/form-data",
      dataType:"json",
      data    :{ data1:data },
      success :function(response) {
        alert("thank u");
      },
      error: function(e) {
        console.log(e.responseText);
      }
    });
    

    its better to use console.log() to see detailed information even if the response is a json string. Try the code and let us know if something is logged to the browser console

提交回复
热议问题