没有从ajax调用收到任何数据

时间:2014-04-26 19:11:18

标签: c# jquery asp.net ajax

$.ajax({
    type: "GET",
    contentType: "text/html; charset=utf-8",
    url: "secret.aspx",
    data: {
        plu: $("#Text1").val(),
        gh: $("#TextBox1").val(),
        sid: $("#TextBox2").val()
    },
    dataType: "html",
        success: function(data) {

            $("#result").html(data);
                               }
    });

我正在拨打aspx页面,呼叫正常。数据输入数据库,但值不会返回到页面

退货声明如下:

Response.Write("hello");
Response.End();

1 个答案:

答案 0 :(得分:0)

它应该工作。也许secret.aspx发生错误。要找到答案,请在ajax调用中添加error设置,以便了解任何错误。您还可以添加警报以显示返回的数据,以防它与您的result元素有关:

                success: function (data) {
                    alert(data);
                    $("#result").html(data);
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status + ' - ' + xhr.responseText);

                    alert(thrownError);
                }
            });
相关问题