jquery
  • ajax
  • json
  • jquery-ui
  • dialog
  • 2010-03-16 56 views 2 likes 
    2

    是否可以將Ajax帖子與jQuery UI對話框結合起來? 我要處理的JSON的AJAX效應初探到HTML的對話框內顯示jQuery UI對話框和Ajax POST,JSON

    var url = AJAX_URL+requestId+'/'+userId; 
    // Need to POST the requestId and userId instead of GET 
    
    $("body").append("<div id='dialog-modal'>Loading...</div>"); 
    $("#dialog-modal").dialog("destroy"); 
    $("#dialog-modal").load(url).dialog({ 
        modal: true, 
        title: "Update Status", 
        buttons: { 
         Cancel: function() { 
          $(this).dialog('close'); 
         }, 
         Update: function() { 
          // Do something 
         } 
        } 
    }); 
    
    +0

    我已經把我已經在到目前爲止的代碼完成,目前所有的參數需要通過URL發送與呼叫(「#對話框的模式」)負載(URL) ;這實際上是一個GET請求,我如何將其更改爲POST? – 2010-03-16 10:11:26

    回答

    8

    你可以改變它提供的數據作爲對象爲POST。

    例如:

    $("#dialog-modal").load(url, {"requestId": requestId, "userId": userId}) 
    
    相關問題