How to convert HTML Forms into AJAX simply


Posted on November 7th, by Alaa Badran in AJAX, DHTML, Free Stuff, HTML, Java Script, Jquery, PHP, Web & Programming, Web Browsers, XHTML. 3 comments

How to convert HTML Forms into AJAX simply

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 :)





3 thoughts on “How to convert HTML Forms into AJAX simply

Leave a Reply

Your email address will not be published. Required fields are marked *