Я пытаюсь вызвать совместно используемую функцию vb из разметки с помощью ajax-вызова, но она не возвращает строку, она возвращает разметку всей страницы.
ajax-вызов от кнопки #apply в файлеphilipp.aspx
jQuery("#apply").click(function () {
jQuery.ajax({
type: "GET",
url: "philipp.aspx/Test",
dataType: "text",
success: function (data) {
console.log(data + " Successful")
},
error: function (data) {
console.log(data.status + " Not Successful")
}
});
});
vb code-behind в philipp.aspx.vb
Imports System.Web.Services
Imports System.Web.Script.Services
<ScriptService()>
Partial Public Class PhilippPage
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
<WebMethod()>
Private Shared Function Test() As String
Dim msg As String = "Horray"
Return msg
End Function
End Class
выполняется функция успеха ajax-вызова ...