Skip to content

Instantly share code, notes, and snippets.

@mygoare
Created February 10, 2012 10:18
Show Gist options
  • Save mygoare/1788523 to your computer and use it in GitHub Desktop.
Save mygoare/1788523 to your computer and use it in GitHub Desktop.
ajax
ajax原理
ajax对象
open()打开 open(method,url,true) the url -- a file on a server.
onreadystatechange
send()
GET方法在open()时即可发送信息体
e.g.
xmlhttp.open("GET","demo_get2.asp?fname=Henry&lname=Ford",true);
而POST方法则是在send()方法中
e.g.
xmlhttp.open("POST","ajax_test.asp",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("fname=Henry&lname=Ford");
参考URL:http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment