用jquery发送get请求
function AjaxSubmit1() {
$.ajax({
//用jQuery发送
url: '/app04/ajax1/',
type: 'GET',
data: {'p':123},
success:function () {
}
})
}
原生发送get请求
function AjaxSubmit2() {
//原生发送请求
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
// 接收完毕服务器返回的数据
console.log(xhr.responseText);
}
};
xhr.open('GET', '/app04/ajax1?p=123');
xhr.send(null);
}