samedi 4 février 2017

Laravel 5.0 routes - POST URL with query string invoke controller defined for GET

I have 2 different controllers defined for GET and POST methods in the routes for the same URL, but when I use the paginator, it adds the query string to the end of the URL, I made the paginator links to make a AJAX POST on clicking, but it invokes the GET controller, below is the code in the Routes

Route::get('assets' , 'Assets\AssetController@index');
Route::post('assets', 'Assets\AssetController@searchResults');

this is the URL to which the AJAX POST request is made.

http://ift.tt/2l4p63K

javascript code that does the AJAX POST

var url = $(obj).attr('data-page');
$('#assetsform').attr('action', url);
$('#assetsform').ajaxSubmit(function(response) {
        $('.results-table').append(response);
    }                   
);

Am I missing anything? please advise, I need the request to go to POST controller.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l8ls5P
via IFTTT

Aucun commentaire:

Enregistrer un commentaire