JavaScript display new page when submit HTML form

前端 未结 4 1805
庸人自扰
庸人自扰 2021-01-07 14:02

Suppose I have 2 html files: form.html and confirm.html

form.html just have a text field and a submit button, when you hit submit it will display what you just typed

4条回答
  •  情深已故
    2021-01-07 14:32

    What you could do is submit the form using a get method (method="get"), and send it to your confirm.html page (action="./confirm.html").

    Then, you could use jQuery to retrieve the values from the URL from your confirm.html page.

    This website provides a method to do that: http://jquerybyexample.blogspot.com/2012/06/get-url-parameters-using-jquery.html .

    Then, all you have to do is call your display() method.

提交回复
热议问题