2015-07-12 118 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); 
});