get()
$.ajax({
//请求的方式
type:‘GET’,
//发送请求的地址以及传输的数据
url:‘1.php?name’’+=xxx,
//服务器的类型
dataType:‘jsonp’
//发送成功:
success:function(da){
console.log(da)
},
//发送失败
error:function(){
}
})
post()
$.ajax({
//请求的方式
type:‘POST’,
//发送请求的地址
url:‘1.php’,
//传给服务器的参数
data:{‘name’:‘张三’},
//服务器的类型
dataType:‘jsonp’
//发送成功:
success:function(da){
console.log(da)
},
//发送失败
error:function(){
}
})