簡體   English   中英

在JQuery加載方法中使用post傳遞數據

[英]Passing data using post in the JQuery load method

我正在使用以下代碼在Django應用中將數據傳遞到視圖,但是對於某些無法在視圖中訪問它的人。 我是錯誤地傳遞了它,還是試圖錯誤地訪問它,並且想知道你們是否可以幫助我。

jQuery("#garbage").load(
    '/search/loadBottomLooks/',
    {'pageNum':2},
    function(responseText, responseStatus) {
        alert('got into the callback');
    }
)

視圖:

pageNum = request.POST['pageNum']

謝謝!

.load()使用GET, $.post() post $.post()是您要發送帖子的內容:

 $.post("/search/loadBottomLooks/", 
 { pageNum: "2" },
 function(responseText, responseStatus){ 
      alert('got into the callback!'); 
      $("#garbage").html(responseText);
 });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM