使用jQuery ajax从ASP.NET 1.1调用web服务方法,不返回任何数据。
我托管了一个web服务,该服务由jQuery ajax从ASP.NET 1.1调用 下面是我用来调用web服务的代码:使用jQuery ajax从ASP.NET 1.1调用web服务方法,不返回任何数据。,asp.net,web-services,Asp.net,Web Services,我托管了一个web服务,该服务由jQuery ajax从ASP.NET 1.1调用 下面是我用来调用web服务的代码: function OnTrimLevelChange() { var $jDecode = jQuery.noConflict(); var vin = $jDecode("input[id*=txtVIN]").val(); var styleId = ''; var paramList = '{"vin": "' + vin + '","s
function OnTrimLevelChange()
{
var $jDecode = jQuery.noConflict();
var vin = $jDecode("input[id*=txtVIN]").val();
var styleId = '';
var paramList = '{"vin": "' + vin + '","styleID": "' + styleId + '"}';
try
{
$jDecode.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: 'http://192.168.10.10/VINDecoder/service.asmx/CallADSWebMethod',
data: paramList,
dataType: 'json',
success: function(data) {
alert('I am here');
},
error: function(xml,textStatus,errorThrown) {
alert(xml.status + "||" + xml.responseText);
}
});
}
catch(er)
{
}
}
=========================================================================上面的总是转到错误部分。
错误:
xml.status=0
xml.responseText=null
Web方法代码为:
[WebMethod]
public VINDescription CallADSWebMethod(string vin, string styleID)
{
VehicleDescription vehicleDescription = FetchVehicleInfo(vin, true, styleID);
VINDescription vinDescription = new VINDescription();
try
{
if (vehicleDescription != null)
{
//Check if the response status of the call is successful or not.
if (vehicleDescription.responseStatus.description.Equals("Successful"))
{
vinDescription = AddToVINDescription(vehicleDescription);
}
}
}
catch (NullReferenceException ex)
{
}
return vinDescription;
}
注意:webservice是在.NET4.0中创建的,我调用的站点是在1.1中。
它们托管在不同的服务器上
请让我知道我在这里缺少什么,或者我犯了什么错误。需要在web服务中启用脚本服务执行。像这样:
[ScriptService]
您返回的错误是什么?xml.responseTextxml.status=0 xml.responseText=nothing