This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

form + javascript

Requests for new symfony features.

form + javascript

by igharbi » Thu Mar 26, 2009 6:55 pm

hi,

i want to know how to submit a form with javascript ( i use jqueery)?
igharbi
Junior Member
 
Posts: 6
Joined: Tue Mar 17, 2009 6:21 pm

Re: form + javascript

by simply_jhen » Tue May 25, 2010 1:31 pm

Yes, you can use jquery. The paramters are the following:

<ul type="disc">
<li>URL - the path of a file which the request will be sent
<li>data - data you wish to send
ex.
$("#formID").serialize() - where all the elements inside the form will be sent
<li>success - (data, textStatus, XMLHttpRequest) A callback function that is executed if the request succeeds.
<li>dataType - The type of data expected from the server. ex. json, xml
</ul>


Code: Select all
$.post('test.php', function(data) {
   //you can do something in here
    $('.result').html(data.message);// Set the HTML contents (data.message) of each element in the set of matched elements.
}, 'json');
simply_jhen
Junior Member
 
Posts: 1
Joined: Thu May 20, 2010 4:24 pm