Using Laravel 4.2, I have a resource controller setup like this:
Route::resource('faq', 'ProductFaqController');
When I hit the /faq URL on my server, the controller's index() method correctly loads.
In a js file, I would like to make an ajax call to one of the other actions for this resource controller, for example, the store action. Therefore, I do something like this:
$.ajax({
url:'store',
dataType:'json',
success:function(data){
console.log(data);
}
});
The problem I'm having is that since the URL is /faq (without a trailing slash), the ajax call gets made to /store, instead of /faq/store.
Am I missing something here or do I need to prefix the url for all of my ajax calls with the route?
If I do need to add some sort of prefix, how do I get the appropriate prefix to use no matter resource controller is being called?