比如jsp页面中有一个id,如何通过jquery的$.ajax()方法将这个id传给action中的user.id?主要是ajax({...})
1个回答
展开全部
假如你的ID存放在这里 <input type="hidden" id="uID" value="XXX" />
jQuery.ajax({
url: '你的action',
data:{uId:$("#uID").val()},
complete: function(xhr, textStatus) {
//called when complete
},
success: function(data, textStatus, xhr) {
//called when successful
alert(data.name);
},
error: function(xhr, textStatus, errorThrown) {
//called when there is an error
}
});
jQuery.ajax({
url: '你的action',
data:{uId:$("#uID").val()},
complete: function(xhr, textStatus) {
//called when complete
},
success: function(data, textStatus, xhr) {
//called when successful
alert(data.name);
},
error: function(xhr, textStatus, errorThrown) {
//called when there is an error
}
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询