使用jQuery调用VB .NET WebMethod的问题 [英] Issue calling VB .NET WebMethod using jQuery

查看:48
本文介绍了使用jQuery调用VB .NET WebMethod的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从jQuery调用WebMethod,但是它似乎不执行成功或失败方法,也不返回错误.尽管我将其归结为绝对基础.

I'm calling a WebMethod from jQuery, but it does not seem to execute the success or failure Methods, nor return an error. This is despite me stripping it down to absolute basics.

这是我第一次这样做,所以我一定会丢失一些东西.

This is the first time I'm doing it, so I must be missing something.

这是我的WebMethod

This is my WebMethod

<ServiceContract(Namespace:="")>

<AspNetCompatibilityRequirements(RequirementsMode:=
AspNetCompatibilityRequirementsMode.Allowed)>
Public Class Timebox

<OperationContract()>
Public Shared Function CreateNew() As String

  Return "testing"

End Function

End Class

这是jQuery调用

    $.ajax({
    type: "POST",
    url: "/App_Code/Timebox.vb/CreateNew",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
      var results = (response.d);
      alert(results)
    },
    failure: function(response) {
        alert(response.d);
    }
});

推荐答案

感谢您的建议.我最终设法通过使用ASP使它起作用.使用ScriptManager调用Web服务的Net AJAX框架

Thanks for the suggestions. I eventually managed to get this to work by using the ASP. Net AJAX Framework way of calling Web services using ScriptManager

这篇关于使用jQuery调用VB .NET WebMethod的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆