为什么我在Laravel中得到405方法不允许错误

时间:2019-03-06 07:42:53

标签: javascript laravel

调用ajax函数但出现此错误-

  

home / asif / fanslive / vendor / laravel / framework / src / Illuminate / Routing / RouteCollection.php。

     

请求方法:POST

     

状态码:405方法不允许

     

远程地址:192.168.0.4:80

     

推荐人政策:降级时不推荐人

这是代码-

window.ajaxCall = function (url, data, method, dataType, successHandlerFunction, processDataFlag, contentTypeFlag) {
if(typeof(processDataFlag) == 'undefined'){
  processDataFlag = true;
}
if(typeof(contentTypeFlag) == 'undefined'){
  contentTypeFlag = 'application/x-www-form-urlencoded';
}
$(".js-data-table .overlay").show();
geturl = $.ajax({
    url: url,
    data: data,
    processData: processDataFlag,
    contentType: contentTypeFlag,
    type: method,
    dataType: dataType,
    cache: false,
    success: successHandlerFunction,
    headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
    complete: function() {
        $(".js-data-table .overlay").hide();
    }
});
}

var data = "latitude=54&longitude=21&id=1"';
ajaxCall("getGenralSettingData", data, 'POST', 'json','');
Route::group(['prefix' => '{club}',  'middleware' => ['check.cms.panel']], function()
{
    Route::post('/getGenralSettingData', 'SampleController@getGenralSettingData')->name('backend.sample.data');
});

0 个答案:

没有答案