By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

Posting from form to server using AJAX

P: 5
I'm an experienced web/CGI programmer, but new to ajax.
I'd like to review some examples of how to post data from a
form to server using AJAX. I have already created some examples
successfully that read data from a server to a form using
'get' as the first argument to the open() method

Also:
I have a client who wants to post some very large forms using
AJAX, but I'm concerned about the limits of the size of the
argument to the send() method of an ajax object.
I presume that I will need to write javascript code that 'walks'
thru form elements and concatenates a string in the
follow format var1=val1&var2=val2...... escaping as necessary.

My concern is that the form may have as many as 600 fields!
I'd welcome both simple examples to get started and comments
on whether there is a limit on the size of the send() method argument string.
Thanks
Tim
Nov 29 '07 #1
Share this Question
Share on Google+
9 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Here's an example to get you started.

I'm not sure about the limits. Give it a try and see how it goes.
Nov 29 '07 #2

Dasty
Expert 100+
P: 101
You should care about size limits only with sending "get" requests. Sending "post" requests are not limited by protocol spec. The only limit I can see is javascript string limit, but not technology itself. Anyway 600 items are far from limits, so dont worry. (I was using strings up to 100Mb long when I was tring memory leeks in IE)

If you want to send such a huge forms, you should write function to serialize them into string, like "AjaxRequest.serializeForm" one here: http://www.ajaxtoolbox.com/request/source.php

Check it out ...
Nov 29 '07 #3

acoder
Expert Mod 15k+
P: 16,027
If you want to send such a huge forms, you should write function to serialize them into string, like "AjaxRequest.serializeForm" one here: http://www.ajaxtoolbox.com/request/source.php
Yes, a nice and compact function and using encodeURIComponent instead of escape.
Nov 29 '07 #4

P: 5
Thanks to all for the replies. This is going to get me started.
I will go over all code examples later today.
:-)And unless I get *really* lucky, you will hear from
me again.
Cheers
Tim
Nov 29 '07 #5

P: 5
Just wanted to add:
Documentation and examples for this are:
Here
Tim
Nov 30 '07 #6

acoder
Expert Mod 15k+
P: 16,027
Thanks to all for the replies. This is going to get me started.
I will go over all code examples later today.
:-)And unless I get *really* lucky, you will hear from
me again.
OK, no problem. Let us know how you get along.
Nov 30 '07 #7

P: 5
It looks like AjaxRequest.js is an industrial-strength module and
is just what I need.
But I have a related question:
I think it is going to be more productive to have a custom
server application running on the server side.
I'm a python programmer (among other PLs) and I'm looking at
the documentation for the CGIHTTPServer module, which would
do most of the heavy lifting for such a customer server.

There is documentation for this module Here
and there are references there to an inability to handle redirects
via http 302. Could this be a problem?
thanks
Tim
Dec 4 '07 #8

acoder
Expert Mod 15k+
P: 16,027
There is documentation for this module Here
and there are references there to an inability to handle redirects
via http 302. Could this be a problem?
I think this question would be better suited to the Python forum.
Dec 5 '07 #9

P: 5
You're correct. Poorly posed question....
I guess my question should have been
What's http 302?
And how relevant is it to ajax?
and I can google that.
Thanks
Tim
Dec 5 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.