今天刚开始学习jQuery ajax,按照教程说的但是没有用。
HelloWorld
是方法名,但是根据报错信息,好像不是方法名而是页面名。
jQuery
$(document).ready(function () {
//alert("hello world");
$('.ordernumber').on('click', function () {
var orderNum = $(this).text();
$.ajax({
type: "POST",
url: "./OrderDetail.asmx/HelloWorld",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg);
// Do interesting things here.
}
});
//alert($(this).text());
});
});
OrderDetail.asmx.vb
Imports System
Imports System.Web.Services
Public Class OrderDetail
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
错误信息:
POST http://localhost:64616/OrderDetail.asmx/HelloWorld 500 (Internal Server Error)