By default, the jQuery.ajax (or $.ajax) function uses the "get" method, 
which passes the data as a querystring tacked onto the url.  So does the 
jQuery.get (or $.get) function.  This is the same as a form submitted 
using the "get" method. 

If you are using the $.ajax function, you can set the "type" option to 
"post" to have it submit as form data, or you can use the jQuery.post 
(or $.post) function.  Either way, it sends the data as form data (same 
as a form submitted using the "post" method.

HTH,
Carl



LTG wrote:
> Serialize is a great method to automatically prepare a form, but it
> doesn't include the element that initiated the submit in the case
> where I attach a click event to a <div> and call submit from the click
> event.
>
> Is there a typical pattern to adding the submit element to the
> serialized string so the server can know which element initiated?
>
> Does it matter what format it's in?  ("submitter=elementId")?
>
> *bonus question*
> This is academic but I'm trying to learn: why does ajax put data in a
> querystring instead of using a form like normal html submit would do?
>
> best regards,
> ltg
>
>
>   

Reply via email to