Form form submitted to the background PHP processing, after processing needs to call the day before yesterday JS a method to show a pop-up layer, but the hint error can not find this JS method, call method is directly echo a section of JS code.
Reply to discussion (solution)
Should be in the background PHP page to introduce this JS method.
And it seems that HTML click to submit the form has been left this page.
Unless you do an Ajax method, do not form. Direct AJAX submissions.
Click the button to trigger Ajax. This will not refresh the original HTML.
Trigger pop-up layer can be written in Ajax onreadystatechange
First introduce JS file
PHP to be executed first, and then sent to the client, you must not find your JS method
Submit with Ajax
The code is posted for analysis, and the error message is also posted.
In your echo this JS method before you write JS introduced
Is this "JS method" only on the form page or on the form target page?
You need it. It's confusing!!!
Either this JS code is not loaded, or the code is defined in a local environment.
How does PHP invoke the JS method??
A run on the server side of a run on the front end, from the server side you initiated the request to run PHP script to return the results of both do not intersect what to call!
The HTML documents before and after the form submission are different, either by using AJAX to request the PHP script to get the data and then using your JS method, or in the production of PHP after the completion of the new page inside processing.
PHP call JS, I generally directly echo "";
is the echo direct output.
The method you can't find is because you did not refer to the definition of your JS method before the Echo output script.
Processing method: 1, you output the JS format right, JS method must have wrapped up
2, the method you output has not been introduced.
Suggest you first output an alert to try, if this is not a problem, you can pop up the form, it means that the method is wrong, or did not introduce JS.
Summarize:
It's really easy to do this with Ajax, but it doesn't happen, but you can't use Ajax if you need to upload a picture. So I'm using the form submission target pointing to a hidden iframe
I tried to use the load JS file before echo, so the problem is that the popup layer gets it, but it doesn't show the current page, but instead prints it to the hidden iframe.
Finally, a compromise method is used, which is displayed directly on a newly opened page.
Above thank you for answering questions!
Landlord This problem I am also looking for solutions to the solution you found it? I tried to use the load JS file before echo, so the problem is that the pop-up layer is acquired, but can not display the current page is not get the current page tangled