使用JQuery Ajax的ISP出错

时间:2018-06-09 18:13:35

标签: jquery ajax

我在Express 2008中使用VB.NET。我使用了很多$ Ajax代码,所有这些都在开发中运行良好。但是我在ISP服务器上部署了一个简单的$ Ajax代码段,而Ajax不起作用。我创建了一张票并从Tech获得了这个:Uncaught TypeError:无法读取属性'd'的null - default.aspx:31

这是Ajax:

function AJAX_GetVoice(strVoice) { 
var obj = {};
obj.strVoice = strVoice;
var jsonData = JSON.stringify(obj);
$.ajax({
type: "POST",
url: "Voice.asmx/GetVoice",
data: jsonData,
contentType: "application/json; charset=utf-8",
dataType: "json",
global: true, // disable ajaxSend, etc
success: function OnSuccess(response) { 

//Note:here is line 31 below

if (response.d == 'Success') {
alert("Success");
}
}

也许数据类型错误,它应该是HTML,而response.d的返回instaed应该是数据。

有人可以帮忙吗?

以下是整个网络服务:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX,     uncomment the following line.  
<System.Web.Script.Services.ScriptService()> _  
<WebService(Namespace:="http://tempuri.org/")> _  
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _  
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _  
Public Class Voice  
Inherits System.Web.Services.WebService  
<WebMethod()> _  
Public Function GetVoice(ByVal strVoice As String) As String  
Return "Success"  
End Function  
End Class

0 个答案:

没有答案