I have simple operations like retrieve a country name from de database with ajax like:
$.ajaxSetup({headers:{'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});
$.ajax(
{
url: 'country',
type: "post",
async: asynchron,
data: data,
dataType: "json",
...
And it works with pages with simple routes like:
Route::get('add_property', 'ViewController@add_property');
But the problem is that in pages with parametric URLs like:
Route::get('mod_property/{ref}', 'ViewController@mod_property')->name('mod_property');
It doesnt work, and in the preview of the response in the network debug window it shows up the MethodNotAllowedHttpException even if the paramètric route it's not the one I'm calling from the ajax function, in fact it's this one:
Route::post('country', 'SimpleOperationsController@country');
So, how can I make ajax work in pages with parametric URLs?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire