打开新窗口时使用会话变量填充文本框

时间:2015-05-11 15:31:57

标签: ajax session-variables

我试图使用ajax调用在父窗口中使用Session变量在新窗口中填充文本框。当使用Fiddler时,我收到一条200条消息,但是,当从代码运行时,我收到500错误。

我知道ajax调用此时只返回一个包含整个JSON结果的警报,因为我还没有完成实际拉取会话变量的步骤。

请提供任何其他解决方案,以便从父窗口中提取Session变量。

来自父母的我的JS如下:

function openRelatedItems(ReportID)
{
    window.open('../WebUserProvider/ReportLibraryView.aspx?r='+ ReportID,'mywin','left=50,top=50,location=no,resizable=yes, status=yes, scrollbars=no, titlebar=no, channelmode=no, directories=no');
    return false;
}

窗口弹出窗口中的我的JS如下:

function callAjaxMethod() {
    $.ajax({

        type: "GET",
        url: "ReportLibraryView.aspx/GetSetSessionValue",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            alert(response.d);
        }
    });
}

$(function () {
    var value = callAjaxMethod();
    var b;
});

我对AJAX调用的代码隐藏如下:

    [System.Web.Services.WebMethod (EnableSession = true)]
    public static string GetSetSessionValue()
    {
        return HttpContext.Current.Session["AppealNo"].ToString();
    }

0 个答案:

没有答案
相关问题