Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

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 );
} );
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

How would I then respond within a table?

Last updated 2 years ago.
0

please elaborate more, I don't understand that question

Last updated 2 years ago.
0

Then in my controller method do something like?

 $q = Input::get('term');
 $pricing = Pricing::where('unit', 'LIKE', '%'. $q .'%');

Or do you suggest something else ?

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lstables lstables Joined 5 Jan 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.