【发布时间】:2012-02-21 03:50:10
【问题描述】:
我正在使用 jQuery 选项卡(来自此示例:http://jqueryui.com/demos/tabs/#manipulation)并希望添加一个包含来自外部源的内容的新选项卡。此外部源需要 POST 参数才能检索数据。从外部源返回的结果应创建并填充一个新选项卡,在新选项卡上显示这些结果。
$( "#tabs" ).tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("Unable to load content for this form. Please contact your web administrator");}
}
});
...
function addTab() {
$.post(
"/test.php", // External source URL
{ id: "11" }, // Sets POST data
function (data) {
$('#tabs').tabs("add", data, $tab_title); // should create a new tab with the results from the external source
}
);
}
我没有工作。其他人有此设置的工作副本吗?
【问题讨论】:
标签: jquery ajax post tabs jquery-ui-tabs