Я использую VB.NET в Express 2008. Я использую много кода $ Ajax, и все отлично работает в разработке.Но я развернул простой фрагмент $ Ajax на сервере ISP, и Ajax не работал.Я создал тикет и получил его от Tech: Uncaught TypeError: Невозможно прочитать свойство 'd' с нулевым значением - 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 должно содержать данные.
Кто-нибудь может помочь?
Вот весь веб-сервис:
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