比如jsp页面中有一个id,如何通过jquery的$.ajax()方法将这个id传给action中的user.id?主要是ajax({...})

如题所述

假如你的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
}
});
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答