you should use Form
helper class for creating forms: http://laravel.com/docs/html
second, you must setup a route that will receive the ajax call, ie
Route::post( 'form', 'PricingController@postForm' )
then your ajax code with jquery, would something like this
$.ajax( {
url: '/form',
data: $( 'form' ).serialize(),
method: 'post'
} ).done( function( dataReponse ) {
console.log( dataResponse );
} ).fail( function( xhr, statusCode, msg ) {
console.err( statusCode, msg );
} );
Yeah I will use the form helper class once I have it working.
the data: $('form') part what is that or can i ref an ID #form for example?
lstables said:
Yeah I will use the form helper class once I have it working.
the data: $('form') part what is that or can i ref an ID #form for example?
whatever you like, obviously the selector has to match a single element
please elaborate more, I don't understand that question
Then in my controller method do something like?
$q = Input::get('term');
$pricing = Pricing::where('unit', 'LIKE', '%'. $q .'%');
Or do you suggest something else ?
arcollector said:
please elaborate more, I don't understand that question
There's a done & fail function which I get but how would i render in a view the response? In order to show the data from the selected row to my table?
lstables said:
Then in my controller method do something like?
$q = Input::get('term'); $pricing = Pricing::where('unit', 'LIKE', '%'. $q .'%');
Or do you suggest something else ?
it's ok!
lstables said:
arcollector said:
please elaborate more, I don't understand that question
There's a done & fail function which I get but how would i render in a view the response? In order to show the data from the selected row to my table?
Nope, js works after the page has been completely downloaded and rendered, so you cannot render again the view, for that thing you need to refresh the page, but it's non sense, because if you need to refresh the page after the user has trigger an action, like a form post, then don't use ajax
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community