2013-05-13 75 views
0

我需要從我這表格數據訪問名爲「PARTNERID」隱藏域的JS代碼:如何從jQuery .submit()事件對象訪問表單POST數據?

$(document).ready(function() { 
    showPartnerSettings = function(e) { 
    e.preventDefault(); 

    var $dialogForm = $("<div />") 
    .attr("id", "partner-settings-form") 
    .append($loading.clone()) 
    .load(envPath + "/partner/settings?partnerid="+e.data.partnerId, null, function(){ $("#partner-settings-form").css("display", "block"); }) 
    .dialog({ 
     title: "Partner Settings", 
     modal: false, 
     resizable: false, 
     width: 580, //CPB 04.11.13 
     position:['middle',130], 
     "close" : function(){ 
     var dialogid=$(this).parent("div").attr("id"); 
     $("#Tabs ul li."+dialogid).remove(); 
     $(this).remove(); 
     $("#alertmod").remove(); 
     //$link.removeClass('preventclick'); 
     }, 
    })   
    .dialog("open") 
    .css("display", "block"); 

    return false; 
    }; 

有什麼辦法來檢索傳遞到showPartnerSettings()事件對象這個價值?

回答

0

您將需要在之後訪問它它已被加載到DOM中。

var $dialogForm = $("<div />") 
    .attr("id", "partner-settings-form") 
    .append($loading.clone()) 
    .load(envPath + "/partner/settings?partnerid="+e.data.partnerId, 
      null, 
      function(){ 
       /* access field here ... */ 
       var field = $('#partnerId'); 

       $("#partner-settings-form").css("display", "block"); 
      } 
    ).dialog({ 
     title: "Partner Settings", 
     modal: false, 
     resizable: false, 
     width: 580, //CPB 04.11.13 
     position:['middle',130], 
     "close" : function(){ 
     var dialogid=$(this).parent("div").attr("id"); 
     $("#Tabs ul li."+dialogid).remove(); 
     $(this).remove(); 
     $("#alertmod").remove(); 
     //$link.removeClass('preventclick'); 
     }, 
    })   
    .dialog("open") 
    .css("display", "block"); 
+0

'$(「#partnerId」).val()'獲得它的值。 – Jasen 2013-05-13 22:39:10