将TextBox值从jquery对话框传递给函数中的变量

时间:2012-04-03 18:47:51

标签: javascript jquery asp.net

我有以下文件:

FILE1.ASPX

function DDialog(url, title, height, width) {
    HideDialogs();
    var dialogButtons = [{
        text: "Save",
        click: function () {

    var data = {};
    data.HolidayDate = $('#txtHireDate').val();
    alert(data.HolidayDate);

    var jsondata = $.toJSON(data);

    ajaxManager.add({
        type: "POST",
        url: "ChangeHireDate.aspx/DoIt",
        data: jsondata,
        contentType: "application/json; charset=utf-8",
        dataType: "text json",
        beforeSend: function (xhr) {
            xhr.setRequestHeader("Content-type",
                         "application/json; charset=utf-8");
        },
        success: function (msg) {
            alert("WORKS");
        },
       /* error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("Could not save holiday.");
        }*/
        error: function (xmlRequest) {
                    alert(xmlRequest.status + ' \n\r ' + xmlRequest.statusText + '\n\r' + xmlRequest.responseText);
        }
    });
...

FILE2.ASPX(对话窗口) TextField从日历扩展程序获取日期

问题是我不知道如何在点击按钮时将日期从文本字段传递给data.HolidayDate。

0 个答案:

没有答案