How does php call the js method form and submit it to PHP in the background for processing? after processing, a method of js the day before yesterday needs to be called to display a pop-up layer, but the js method cannot be found when an error is prompted, the call method is & nbsp; direct echo & nbsp; a piece of js code. How does PHPJava php call js methods?
Form is submitted to PHP in the background for processing. after processing, you need to call a method of js the day before yesterday to display a pop-up layer, but the js method cannot be found when an error is prompted, the call method is to directly echo a piece of js code.
PHP JavaScript
Share:
------ Solution --------------------
This js method should be introduced in the background PHP page.
In addition, it seems that the HTML page has been left when you click to submit a form.
Do not use form unless you do an Ajax method. Direct Ajax submission.
Click the button to trigger Ajax. In this way, the original HTML will not be refreshed.
The trigger pop-up layer can be written in onreadystatechange of Ajax.
------ Solution --------------------
Introduce js files first
------ Solution --------------------
Php must be executed first and then sent to the client. your js method cannot be found.
------ Solution --------------------
Introduce the js you wrote before you echo this js method
------ Solution --------------------
This "js method" is only in the single table page or in the form Target page?
------ Solution --------------------
How does php call js methods ??
One is running on the server and the other is running on the front end. there is no intersection between your request and the PHP script running on the server and the returned results. why!
The html documents before and after the form is submitted are different, or you need to use ajax to request the php script to obtain data and then use your js method for processing, or you need to process the data in the new page produced after php is run.
------ Solution --------------------
That is, echo outputs directly.
The method cannot be found because you did not reference the definition of your js method before echo output this script.