weixin_33725239 2013-08-20 01:17 采纳率: 0%
浏览 18

AJAX编码中的可变代码

i found a code fore an ajax tutorial,and am not familiar with some part of the code there

ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            document.myForm.time.value = ajaxRequest.responseText;
        }
    }
    ajaxRequest.open("GET", "pay.php", true);
    ajaxRequest.send(null); 

can someone please tell me what the above code means,are there any variables,etc? I am aware that pay.php is the php file it reffers to,but what does the first three line of coding mean?

  • 写回答

1条回答 默认 最新

  • from.. 2013-08-20 01:25
    关注

    The XMLHttpRequest object has a property called readyState. This is where the status of your server's response is stored. The response can be processing, downloading or completed. Each time the readyState changes then our onreadystatechange function executes.

    When the property readyState is 4 that means the response is complete and you can get your data.

    The function refers to a textbox named time,in a form named myform"The value is taken from the code in pay.php file.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败