2015-07-12 82 views
0

我與波紋管腳本如何轉換我的GET請求,POST請求

$(document).ready(function() { 
    $("#test-list").sortable({ 
     handle : '.handle', 
     start: function(){ 
      $("#success-result").html("loading...."); 
     }, 
     update : function() { 

      var order = $('#test-list').sortable('serialize'); 
     $("#success-result").load("<?php echo base_url('explorer/processSortable'); ?>?"+order); 
     } 
    }); 

現在我要發送請求給我的網址與POST方法的工作。我該怎麼做。

+0

到這裏看看:http://api.jquery.com/jquery.post/ –

+0

不javascript代碼裏面混合PHP代碼,這樣做' var url =「<?php echo base_url('explorer/processSortable');?>?」;'在你的js代碼之上 –

回答

0

Jquery加載函數是從服務器獲取內容的簡寫方法。默認情況下,如果數據作爲對象提供,則使用POST方法;否則,假定爲GET。

使用.post的$代替:

$.post("<?php echo base_url('explorer/processSortable'); ?>?"+order, function(data) { 
    $("#success-result").html(data); 
});