how to post data to server using AJAX?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sony_George
Posted On:   Tuesday, February 21, 2006 08:51 AM

hello everybody when searching in net i came to know that, to post data to server using ajax i have to use the following method..... req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send("id=" + escape(field.value)); when there is so much elements in the form , for example more than 50 then encoding all this values to url and sending it using the method req.send(); becomes very difficult and some browsers does not allow so much long url encoding. i tried req.send(document.form); but it also doesn't work so is there any way to post data to se   More>>

hello everybody



when searching in net i came to know that, to post data
to server using ajax i have to use the following method.....



req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

req.send("id=" + escape(field.value));



when there is so much elements in the form , for example
more than 50 then encoding all this values to url and sending
it using the method req.send(); becomes very difficult
and some browsers does not allow so much long url encoding.


i tried
req.send(document.form);
but it also doesn't work
so is there any way to post data to server
as simple as we submit a form ??? using ajax ??

   <<Less

Re: how to post data to server using AJAX?

Posted By:   Anonymous  
Posted On:   Thursday, March 30, 2006 04:23 AM

Automate it, select all the input objects in your form you wish to submit, iterate through them,and use their name as the argument, with their value as the value,note: use their _name_,not their id
About | Sitemap | Contact