PHP Development Ajax A _php tutorial

Source: Internet
Author: User

PHP Development of Ajax One


Ajax this east two days ago just contact, listen to others said very useful oh, feel the need to learn.
Here's an example of passing parameters to a PHP page using the Get method:
Test.html

<title></title>

Test.js

var xmlhttp;function Getxmlhttpobject () {if (window.    XMLHttpRequest) {//code for ie7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest ();    }else{//code for IE6, IE5 xmlhttp=new ActiveXObject (microsoft.xmlhttp); } return XMLHTTP;}    -----------Ajax Method-----------//function Testcheck () {xmlhttp=getxmlhttpobject (); if (xmlhttp==null) {alert (' Your browser does not support ajax!        ');    Return } var url=http://localhost/phptest/index.php?isbn=110120;//this place must be noticed oh, at first I was in '    = ' preceded by a space, the result of PHP page can not get parameters, we must pay attention to some Oh Xmlhttp.open (get,url,true); xmlhttp.onreadystatechange=getokget;//send the event, the message is received after the call function Xmlhttp.send ();} function Getokget () {if (xmlhttp.readystate==1| | xmlhttp.readystate==2| | xmlhttp.readystate==3) {//local prompt: Load in} if (xmlhttp.readystate==4 && xmlhttp.status==200) {alert (       Xmlhttp.responsetext);        Alert (' 123 '); Process return result}}  

index.php


  
   

The other Test.js URL should be the path of your file, don't get it wrong oh, hey
Let's show you how it works!



http://www.bkjia.com/PHPjc/992671.html www.bkjia.com true http://www.bkjia.com/PHPjc/992671.html techarticle PHP Development Ajax an Ajax two days before the first contact, listen to others say very useful oh, feel the need to learn. The following is a get method to pass parameters to the PHP page for example ...

  • 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.