Hello reader,
You may have a normal HTML Form, like: contact form, feedback form or any other forms in your website or any website you work on.
Did you think how difficult converting this FORM into AJAX?
Let me say, it will be very simple. Simple as 1 minute of changes.
How is that, right?
Using the ALAJX (a new jQuery plugin) will make it as simple as that. This plugin deals with forms as the following code:
$("#form_id").alajax();
// OR
$("#div_id").alajax();
The ALAJAX plugin checks the object, if it is not a form then it will look inside the current object for a form. Then it prevent the form from submitting the data (by clicking on Submit button or by pressing Enter) and it sends the data by AJAX to the URL given in action form property. It also use the form method property to send data by POST or GET.
So, there is nothing you are going to do,
- Include the jQuery plugin in your web page (If its already included then skip this one).
- Include the ALAJAX plugin.. download it from here. You also may check the demo page of this plugin by clicking here.
- Call the plugin to enable it. as:
$(document).ready(function (){$("#form_id").alajax();});
- You may need to do some update to you Server-Side scripting code.
Hope you enjoy it 🙂
Tis nice form ajax example: http://cleverscript.ru/index.php/javascript/mootools/5-form-to-ajax-mootools
Nice Plugin! Will use this in my current project! If only I had the idea to put this into a plugin… 🙂
Thank you Fridenmann
It’s already a plugin, check it out here: http://www.alajax.com/