I have a regular POST form for my search function. I currently have the following route:
Route::post('/search', 'PostController@search');
I get the form data using jQuery/AJAX:
$('form').on('submit', function(event)
{
event.preventDefault();
var form = $(this);
$.ajax({
url: '/search',
type: 'post',
data: form.serialize(),
dataType: 'json',
success: function(data)
{
//
},
error: function(data)
{
//
}
});
});
However, when the results page is shown, it only shows /search in the URL without the user's query, like:
http://ift.tt/1Fky9im
What I want is to do something like /search/{user query here}, like:
http://ift.tt/28O1dmT
Essentially, I want to be able to show the user's query within the URL.
How can I do this and how can I do this safely?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire