Re: AJAX with POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yep, much more

Bastien

Sent from my iPod

On Apr 4, 2009, at 21:24, Skip Evans <skip@xxxxxxxxxxxxxxxxx> wrote:

Hey Bastien & all,

...D'oh! Thanks for the catch, yes, I am sending args on the URL. But more to my problem, if I switch to POST will IE be able to submit more data? If so, I can parse the URL down in the function and build a proper post transaction, but my real problem is IE can't submit, apparently, more than 2K through a GET.

Do you know if POST can handle more?

Thanks tons for your reply!

Skip

PS. I'd very interested in seeing your set of functions.


Phpster wrote:
On Apr 4, 2009, at 17:30, Skip Evans <skip@xxxxxxxxxxxxxxxxx> wrote:
Hey all,

At the risk of being told this is a PHP and not a JS list, but also knowing the discussions on this list, to the benefit of all I believe, very wildly, I'm posting this JS code snippet for some advice.

As I posted earlier, my AJAX app that uses a GET to post to the server (and get a response), fails on IE with larger data, so I thought I'd take a shot at writing a POST function, but so far I can get it to get the data back, but the problem is by the time the data has come back the function has already returned null back to the calling function. What I need this function to do is wait for the data to come back and then send it back to caller. Here's the function. Any advice would be greatly appreciated. (The code to get the appropriate object per browser has been omitted.)

http.open("POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form- urlencoded");
http.setRequestHeader("Content-length", url.length);
http.setRequestHeader("Connection", "close");

http.send(url);

http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
  alert('['+http.responseText+']');
  return (http.responseText);
  }
}
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Skip,
You didn't show the code to build the url variable but I would assume that since you started with a get method you are tacking data onto the end of the URL that is the called Ajax page. I had the same issue at work correcting the VP's mistake of mixing up post and get in his ajax call. The trick is to build the data separately from the URL and pass it. I do an ajax.open(URL) then an Ajax. Send(data) to send just the data.
I can post my entire function set if you want.
Bastien

--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux