Ajax Server Section (PHP version)

Source: Internet
Author: User
Tags html page

The server-side tasks are usually logical operations based on the client's request, and the result response is returned. This response is usually in XML format (so the server side needs to use PHP's DOM to create the XML response)

1.PHP uses DOM to create XML responses for client-side JS parsing and then display in the page (so you need a skilled PHP dom API)

In fact, there are two ways to generate XML in PHP:

Using the DOM API; (method one)

The other is to directly echo the content of the XML; (method two)

See Example:

HTML page (contains three JS trigger functions: onmouseover, onmouseout, onclick; trigger its own function)

<!doctype html public "-//w3c//dtd html 4.0 tRANSITIONAL//en">
<title> Server PHP Ajax </title>
<script type="text/javascript" src="js.js"></script>
<span onmouseover="PHPechoXML()" onmouseout="PHPDOMXML()">Default Words</span>
<div id="show"></div>
divide<input type="text" id="firstNumber"/>by
<input type="text" id="secondNumber"/>
<input type="button" value="Send" onclick="CSparameter()"/>
<div id="result"></div>
</body>

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.