@orpha
To send an AJAX parameter as a Laravel route parameter, you can include the parameter in the URL when making the AJAX request. Here is an example:
1
|
Route::get('example-route/{param}', 'ControllerName@methodName'); |
1 2 3 4 5 6 7 8 9 10 |
$.ajax({ url: '/example-route/' + paramValue, type: 'GET', success: function(response) { // Handle the response from the server }, error: function(xhr, status, error) { // Handle errors } }); |
In this code snippet, replace 'example-route'
with the actual route URL, and paramValue
with the value of the parameter you want to send. This value will be included in the URL and passed to the controller method as a parameter.