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

What is the difference between Ajax POST and GET

P: n/a

Hi Everybody,

As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.
regards
Moses

Feb 20 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
mo************@gmail.com wrote:
Hi Everybody,

As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.
regards
Moses
Check out CURL.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 20 '07 #2

P: n/a
On Feb 20, 11:58 pm, "mosesdinaka...@gmail.com"
<mosesdinaka...@gmail.comwrote:
Hi Everybody,

As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.

regards
Moses
I only see difference when you retrieve data in PHP/servers side.
i.e $_POST and $_GET.

Feb 21 '07 #3

P: n/a
Rik
On Wed, 21 Feb 2007 15:36:29 +0100, Satya <sa********@gmail.comwrote:
On Feb 20, 11:58 pm, "mosesdinaka...@gmail.com"
<mosesdinaka...@gmail.comwrote:
>Hi Everybody,

As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.

regards
Moses

I only see difference when you retrieve data in PHP/servers side.
i.e $_POST and $_GET.
That is not entirely true.
A GET request has al it's values in the requested url in the protocol.
This means it's limited in size. A POST request has the POST values in the
body of the request. This means a difference in formatting the data.

--
Rik Wasmus
Feb 21 '07 #4

P: n/a
C.
On 20 Feb, 18:58, "mosesdinaka...@gmail.com"
<mosesdinaka...@gmail.comwrote:
Hi Everybody,

As all knows the difference between GET and POST is in the way how
the data is transfered,
No - there is a difference in how its transfered but there are several
syntactic and semantic differences.
>
But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.
Yes - although:
1) it's nothing to do with PHP
2) it won't work everywhere

If you post (pvar=3) to a url with a query (http://www.example.com/?
gvar=splodge) the relevant variables will appear in the _POST and _GET
arrays. All variables will appear in _REQUEST.

If you look at you javascript which actualy makes the request it will
typically decide at runtime whether to create a document or use
xmlhttprequest.

If it does something like this:

requestor = document.implementation.createDocument(blah,blah,b lah);

then you can't (AFAIK) post.

if on the other hand it does this:

requestor = new XMLHttpRequest(); - for a sensible browser
requestor = new ActiveXObject("Microsoft.XMLHTTP"); - for MSIE
requester.open("GET"...

just amend the javascript to something like:
requestor.open("POST",URL,async);
reqestor.setRequestHeader('Content-type','application/x-www-form-
urlencoded');
(if your using async, set a callback)
requestor.send('posted=something&othervar=4');

HTH

C.

Feb 21 '07 #5

P: n/a
C.
On 21 Feb, 15:05, Rik <luiheidsgoe...@hotmail.comwrote:
>
That is not entirely true.
A GET request has al it's values in the requested url in the protocol.
This means it's limited in size. A POST request has the POST values in the
body of the request. This means a difference in formatting the data.
IIRC the HTTP protocol does not limit the size or a URL - but MSIE
does (to about 2kb)

C.

Feb 21 '07 #6

P: n/a
Thanks Colin and to All.

Moses

Feb 23 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.