Use data option of ajax.(使用ajax的数据选项。)
You can send data object to server by data
option in ajax and the type
which defines how you are sending it (either POST
or GET
).(您可以通过ajax中的data
选项将数据对象发送到服务器,以及定义发送方式的type
( POST
或GET
)。) The default type is GET
method(默认类型是GET
方法)
Try this(试试这个)
$.ajax({
url: "ajax.aspx",
type: "get", //send it through get method
data: {
ajaxid: 4,
UserID: UserID,
EmailAddress: EmailAddress
},
success: function(response) {
//Do Something
},
error: function(xhr) {
//Do Something to handle error
}
});
And you can get the data by (if you are using PHP)(你可以通过(如果你使用PHP)获取数据)
$_GET['ajaxid'] //gives 4
$_GET['UserID'] //gives you the sent userid
In aspx, I believe it is (might be wrong)(在aspx中,我相信它(可能是错的))
Request.QueryString["ajaxid"].ToString();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…