标签:click fse 分享 http alt erro java htm arch
1:jQuery语法

$(function(){
$(‘#searchbtn‘).click(function(){
$.ajax({
type: "GET" ,
url:"JSONsever.php?number=" + $(‘#keyword‘).val(),
dataType :"json",
success : function(data){
if(data.success)
{
$(‘#search_result‘).html(data.msg)
}
else{
$(‘#search_result‘).html("error" + data.msg);
}
},
error : function(jqXHR){
alert("发生错误"+ jqXHR.status)//404错误代码
}
})
});//GET
$(‘#savebtn‘).click(function(){
$.ajax({
type: "POST" ,
url:"JSONsever.php?",
data:{
//JS对象JSON格式
name : $(‘#staffName‘).val(),
number : $(‘#staffNumber‘).val(),
sex : $(‘#staffSex‘).val(),
job : $(‘#staffJob‘).val(),
},
dataType :"json",
sucess : function(data){
if(data.success)
{
$(‘create_result‘).html(data.msg);
}
else{
$(‘create_result‘).html("error" + data.msg);
}
},
error : function(jqXHR){
alert("发生错误"+ jqXHR.status)//404错误代码
}
})
});//POST
})
标签:click fse 分享 http alt erro java htm arch
原文地址:https://www.cnblogs.com/love-life-insist/p/9063808.html