1

I want to pass some textbox value strictly using POST from one html page to another... how can this be done without using any server side language like asp.net or php

can it be done using javascript??

thnx

10
  • Do you want to POST the form with javascript or read the POST data? Commented Jun 5, 2012 at 12:01
  • @madflow I want to first post the data from page1.html to page2.html then read/assign it there. Commented Jun 5, 2012 at 12:03
  • @Sirwani POST request can only be accessed server-side. Use "GET". Commented Jun 5, 2012 at 12:05
  • @Sirwani using GET, you can read the url plus querystring using document.location. You would need to parse the text to pull out your values. Commented Jun 5, 2012 at 12:07
  • @madflow thnx... that means it is not possible..?? hmm... Commented Jun 5, 2012 at 12:07

1 Answer 1

5

You can't read POST data in any way on javascript so this is not doable.

Here you can find similar questions:

http://forums.devshed.com/javascript-development-115/read-post-data-in-javascript-1172.html

http://www.sitepoint.com/forums/showthread.php?454963-Getting-GET-or-POST-variables-using-JavaScript

This reading can also be interesting: http://en.wikipedia.org/wiki/POST_%28HTTP%29

This expecially suggests why this answer (wikipedia is the source):

GET Requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.)[1] The W3C has published guidance principles on this distinction, saying, "Web application design should be informed by the above principles, but also by the relevant limitations."[10] See safe methods below.

POST Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.

POST data is added to the request. When you do a GET request the data is added to the url, and that's why you can access it through javascript (and that's why it's not parsed and you have to do it manually). Instead, POST send data directly into the http requests, which is not seen in any way by the html page (which is just a part of what is sent through the http request).

That said, only server side language will receive the full HTTP request, and definitely you can' access it by javascript.

I'm sorry but that is the real answer

Sign up to request clarification or add additional context in comments.

5 Comments

If that exists, I think we can mark the question as a duplicate.
This is quite an ambiguous question. HTTP is a client-server technology, so in principle, you can't POST to any page that is not on a server.
@Christian: Well, the question isn't amiguous. If you don't know the HTTP protocol you simply don't know you can't read POST data for reasons you explained.
@Fire-Dragon-DoL my intention was not JavaScript.. that was one of the things that can help.... the Q that ClydeFrog has listed is purely based on JavaScript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.