jquery 常用方法
搬迁+学习
原文地址 https://www.idaima.com/a/1663.html
ajax 请求
$(function() {
$('#send').click(function() {
$.ajax({
type: "GET", //GET或POST,
async:true, //默认设置为true,所有请求均为异步请求。
url: "http://www.idaima.com/xxxxx.php",//url 后直接拼接参数也可以,根据实际的接收方式看
data: {
username: $("#username").val(),
content: $("#content").val()
},
dataType: "json", //xml、html、script、jsonp、text
beforeSend:function(){},
complete:function(){},
success: function(data) {
alert(data)
}
error:function(){},
});
});
});
浙公网安备 33010602011771号