(As a new laravel user) I am trying to create an ajax call url via laravel URL :: class:
$.ajax( { url: '{{ URL::route('getUser', ['3']) }}', success: function(results) { alert(results); } });
routes.php:
Route::get('admin/getUser/{user_id}', array( 'as' => 'getUser', 'uses' => ' AdminController@getUser ' ));
Instead of hard-coded 3 this parameter should come from jquery (for example, $(this).attr('user_id') ).
Can someone tell me how to create a URL dynamically?
It seems that because of the route definition, the function URL::route needs the hardcoded parameter or in the form of php varaible.
I hope this is +/- clear ...
Thanks for the help anyway!
source share