每次我使用jQuery.ajax的成功函数时,我都会得到以下结果:
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://tempuri.org/">-105</int>
无论我设置什么数据类型(json,html,xml) - 这都是返回的数据。 如何转义整数(在这种情况下为-105)?
P.S。也许我必须在我的asp.net c #web方法中改变一些方法:
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public int CheckRegistrationFree(string phone)
答案 0 :(得分:2)
这对我有用
$.ajax({
success : function(xml){
alert($(xml).find('int').text());
}
})