ajax post in laravel 5 return error 500 (Internal Server Error)

后端 未结 12 1025
不知归路
不知归路 2020-11-29 05:13

this is my test ajax in laravel 5 (refer below)

$(\"#try\").click(function(){
    var url = $(this).attr(\"data-link\");
    $.ajax({
        url: \"test\",
         


        
12条回答
  •  Happy的楠姐
    2020-11-29 05:45

    90% of the laravel ajax internal server error is due to missing CSRF token. other reasons can inlucde:

    • Wrong Request Type (e.g sending post to get)
    • Wrong data type recived (e.g ajax is expecting JSON and app returns string)
    • Your .htaccess is misconfigured
    • Missing Route
    • Code Error

    You can read further about this in details here: https://abbasharoon.me/how-to-fix-laravel-ajax-500-internal-server-error/

提交回复
热议问题