Simple HTML POST without any server scripting, can be done using JS

后端 未结 1 1208
别跟我提以往
别跟我提以往 2020-12-21 22:49

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.

相关标签:
1条回答
  • 2020-12-21 23:41

    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

    0 讨论(0)
提交回复
热议问题