Is it possible to copy values from a form on page x to a form on page y using javascript. The data is the same but just different pages and different applications?
相关问题
- Is there a limit to how many levels you can nest i
- Laravel Option Select - Default Issue
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
If it's just from one page to another you can append the data to the request as POST (with PHP) variables, or a simple query string (GET) and read them once the page has loaded/populate relevant fields - if the second page is loaded directly from the first.
If it needs to be retained until an unspecified time (when the user may have gone to other pages in the interim) you could look into using cookies.
how to get GET and POST variables with JQuery?
Yes, you can do this. Using AngularJS you could use "search" variables and then plug these into the form. Using normal javascript you may be able to use a # with the data. Using PHP + normal javascript (more secure) you can send a POST to the page (which is a PHP page) and have the page, if the POST params with your values exist, put a javascript fragment on the page setting the values of the form when the page is done loading.
Cookies are also always an option :)
[EDIT]
After discussion, here is the solution to the question: GitHub
Actually, cross-tab JS is not allowed. I am not sure about bleeding-edge apis.
Theoretically, it is possible to do via local storage with a same-origin restriction. But you'd better don't mind this option.
Also, try to play with cookies.
Try something like this: