html - how to submit form data using JS ajax without appending it to url? -
I want to submit a form using AJAX Javascript and want to get the parameter value in the servlet name element?
Please guide.
thanks
use the post instead GET
To use jquery with the method AJAX, you will need to put your form in a Jason object
If your form is like this
& lt; Form id = "form1" & gt; .... & lt; Input id = "idvar1" type = "text" name = "var1" & gt; & Lt; Input id = "idvar2" type = "text" name = "var2" & gt; & Lt; / Form & gt;
You can use the AJAX method like this:
var data = {'var1': $ (# idvar1) .val () 'Var2': $ (# idvar2) .val ()}; // (you) ($ ("$ form1" url, data: data / * here you will send data of your form * /});}); More info about $ .ajax here More about this post here
Comments
Post a Comment