Using Ajax and returning json array in laravel 5

后端 未结 6 584
粉色の甜心
粉色の甜心 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:51

    Your jQuery code has syntax error in success callback, that's why its not making any post request to Laravel, please try below javascript it will work

    
    
    
    

    In Laravel , you can just return array or object and it will automatically convert it to json response

    return ['success' => true, 'data' => $data];
    

提交回复
热议问题