location.search for GET URL only?

M

Mark Anderson

Am I correct in thinking that you can only use location.search to retrieve
all a form's inputs if the method is GET. In my experiments so far, using
search I only get what follows the ? in the returned page. With the
'script' I'm using that gives me nothing in the URL with POST.

I hope that makes sense. Am I missing something?

Mark
 
M

Michael Winter

Am I correct in thinking that you can only use location.search to
retrieve all a form's inputs if the method is GET. In my
experiments so far, using search I only get what follows the ? in
the returned page. With the 'script' I'm using that gives me
nothing in the URL with POST.

Location.search isn't specific to form submittal. It simply returns a
string containing everything in the URI associated with the Location
object from the question mark (?) onwards.

The GET submission method passes data using the URL. The POST method uses
HTTP headers[1].

There is no way for JavaScript to access POST data directly.

Mike


[1] If I remember correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top