如何使用ajax函数发布按钮值我已经尝试过以下代码

时间:2015-08-17 13:25:25

标签: javascript jquery ajax

在是,没有对话框,如果单击是按钮或没有按钮如何使用ajax功能发布按钮值我已尝试下面的代码请帮助我解决这个问题。

 function yesnodialog(button1, button2, element) {

            var btns = {};
            btns[button1] = function () {

                **$.ajax({ type: 'POST', url: 'Default.aspx/insertworkpermitstatus', cache: false, data: "{'workpermityes':'" + button1 + "','workpermitno':'" + button2 + "'}", contentType: 'application/json; charset=utf-8', dataType: 'JSON',
                    success: function (data) {
                        if (data.d == true) {
                            alert(button1);
                        }
                    }
                });**

                Open_Dialog1('#tblPrevSchdWorkPermit', true, true, true, false, 1150, 800, 'slideRight', 'slideLeft', 200, 200, false);
                element.parents('li').hide();
                $(this).dialog("close");
             };
            btns[button2] = function () {

                $.ajax({ type: 'POST', url: 'Default.aspx/insertworkpermitstatus', cache: false, data: "{'workpermityes':'" + button1 + "','workpermitno':'" + button2 + "'}", contentType: 'application/json; charset=utf-8', dataType: 'JSON',
                    success: function (data) {
                        if (data.d == true) {
                            alert(button2);
                        }
                    }
                });
                // Do nothing
                $(this).dialog("close");
            };
            $("<div>In case you are creating Work Permit in this System click YES, In case you are following Manual Work Permit outside this System click NO</div>").dialog({

                autoOpen: true,

                title: 'Create Work Permit',
                text: 'OK',
                modal: true,
                buttons: btns
          });
        }
        $("#aPrevSchdCreateWorkPermit").click(function () {
            yesnodialog('Yes', 'No', $(this));


        })

提前致谢。

0 个答案:

没有答案