zoukankan      html  css  js  c++  java
  • AJAXjs

    JavaScript 中:

    function ajax(){

    var xmlHttpRequerst;

    try{

     xmlHttpRequest = new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari

    }catch(e){

    xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");// code for IE6, IE5

    }

    //执行

    xmlHttpRequest.onreadystatechange(function(){

    if(xmlHttpRequest.readyState==4 && xmlHttpRequest.status==200)//readyState (0/1/2/3/4) ;status(200/404)

    document.getElementsById("ID").innerHTML(xmlHttpRequest.responseText);//xmlHttpRequest.responseText or xmlHttpRequest.responseXML返回参数

    })

    //设置参数

    xmlHttpRequest.open("GET","URL?parm="+"参数",true);// open(method,url,true)1:method --can be GET or POST;2:parm --get from form;

    //发送

    xmlHttpRequest.send();

  • 相关阅读:
    bzoj2555-SubString
    离散对数
    xsy1436-括号游戏
    bzoj1143-祭祀
    连通分量
    bzoj3864-hdu4899-Hero meet devil
    bzoj3238-差异
    poj1065-Wooden Sticks
    多项式除法
    JavaScript 对象
  • 原文地址:https://www.cnblogs.com/leonkobe/p/2882655.html
Copyright © 2011-2022 走看看