How does php call the js method?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.