开发者

Do not clear inputs after submit

开发者 https://www.devze.com 2023-04-02 06:14 出处:网络
Is there some kind of trick t开发者_StackOverflow中文版o keep input data after Form.submit(); Or must I fill it manually?

Is there some kind of trick t开发者_StackOverflow中文版o keep input data after Form.submit(); Or must I fill it manually?

Form.submit(); clears all fields


The form will clear by default when the page refreshes.

There's a couple of things you could:

  1. use ajax to post your form to the server, thus eliminating the page refresh
  2. re-bind the data to the form fields on the server side after processing
  3. there's other options too but i'm trying to be brief


You have to fill it in. however, I do not think you can do this with Javascript since form data is posted to the server.


Use the simple serialize() to get the url and then use the ajax post or get as you wish. Here are the links which will help you:

http://api.jquery.com/jQuery.post/

http://api.jquery.com/serialize/

0

精彩评论

暂无评论...
验证码 换一张
取 消