小编pav*_*van的帖子

“加载资源失败:服务器响应状态为 500(内部服务器错误)”

在使用 ajax 使用 JavaScript 调用 html 页面中的 Web 服务时,我真的无法理解这里的确切问题是什么,因为它会产生以下错误:

加载资源失败:服务器响应状态为 500(内部服务器错误)

阿贾克斯代码:

function Image() {
    $.ajax({

        type: "POST",
        url: "WebService.asmx/GetImage",
        data: "{'sDB': '" + "sDB" + "'}", 
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnGetMemberSuccess,
        failure: function (errMsg) {
            $('#errorMessage').text(errMsg);  //errorMessage is id of the  div
        }
    });
    function OnGetMemberSuccess(data, status) {
        alert("data" + data.d);
        $("#MemberDetails").html(data.d);
        $('input[type=button]').attr('disabled', false);
    }
}
Run Code Online (Sandbox Code Playgroud)

其中 sDB 为 Null。

按钮点击代码:

<input type="button" id="Button" value="Image" onclick="Image()" />
Run Code Online (Sandbox Code Playgroud)

我在以前的项目中使用了相同的代码,但工作正常。

网络服务代码:

<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> <WebMethod()> _
Public Function GetImage()

    Dim cmd …
Run Code Online (Sandbox Code Playgroud)

javascript vb.net ajax web-services

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

ajax ×1

javascript ×1

vb.net ×1

web-services ×1