-2

我有下一个按钮,通过单击此按钮,我必须在同一个对话框中打开下一个客户数据,但我没有关闭 jquery 中的旧对话框。我怎样才能?

$("#GetCustomerId").click(function GetCustomerData(custno,arrow,indexno){
    var loc = window.location;
    var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);
    $("#dialog-Customer",parent.document).dialog({
         autoOpen: false,
         height:720,
         width: 1200,
         modal: true,
         open: function (event, ui) {
               $('#dialog-Customer').css('overflow', 'hidden');
               $(event.target).parent().css('position', 'absolute');
               $(event.target).parent().css('top', '0px');
               $(event.target).parent().css('left', '85px');
               }
    });
    $.ajax({  
        type: "POST",  
        url: pathName+"GetNextCustomerData.do",  
        data:{indexno:indexno,custno:custno,arrow:arrow},
        beforeSend:function(){
            $('#dialog-Customer',parent.document).html('<div class="loading"><img src="images/loading_big.gif" alt="Loading..." /></div>');
        },
        success: function(response){  
            $('#dialog-Customer',parent.document).html(response);  
        },  
        error: function(e){  
            alert('Error: ' + e);  
        }  
    });
    $("#dialog-Customer",parent.document).dialog("open");
});
4

1 回答 1

1

1)从 click(function..
2) 中删除弹出定义,将其单独放置
3) 成功打开对话框。

$("#dialog-Customer",parent.document).dialog({
     autoOpen: false,
     height:720,
     width: 1200,
     modal: true,
     open: function (event, ui) {
           $('#dialog-Customer').css('overflow', 'hidden');
           $(event.target).parent().css('position', 'absolute');
           $(event.target).parent().css('top', '0px');
           $(event.target).parent().css('left', '85px');
           }
});

$("#GetCustomerId").click(function GetCustomerData(custno,arrow,indexno){
var loc = window.location;
var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);
$.ajax({  
    type: "POST",  
    url: pathName+"GetNextCustomerData.do",  
    data:{indexno:indexno,custno:custno,arrow:arrow},
    beforeSend:function(){
        $('#dialog-Customer',parent.document).html('<div class="loading"><img src="images/loading_big.gif" alt="Loading..." /></div>');
    },
    success: function(response){  
    $("#dialog-Customer",parent.document).dialog("open");
        $('#dialog-Customer',parent.document).html(response);  
    },  
    error: function(e){  
        alert('Error: ' + e);  
    }  
});

});

于 2013-01-23T10:17:54.153 回答