开发者

Sending POST data via AJAX through jQuery's tab ui

I'm trying to use jquery's tab ui to load search results in a tabbed panel. When the user clicks a tab, I want to send an ajax request to re-echo the results in the correct order.

I'm having trouble though sending any data via the POST (or Get for that matter) method. As you can see, I have even manually entered key and data info just to see if it's working. The ajax is getting called. I can echo something successfully, but when I do a var_dump of post (and get), it's empty.

var post_variables 开发者_StackOverflow= [{name:'location_city',value:'Russellville'}];
$(function() {
 $( "#sort_tabs" ).tabs({
  fx: {
   opacity: 'toggle',
   duration: 'slow'
  }  
 }).find( ".ui-tabs-nav" ).sortable({ axis: "x" });
});

$('#sort_tabs').tabs({ajaxOptions: {
 data: post_variables,
 type: 'POST'
 }
});


post_variables needs to be an object, not an array. You should remove the extra [] brackets around your data.

var post_variables = {name:'location_city',value:'Russellville'}; 

Before, you were sending an array with just one object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜