$ui.ajax,JQuery-ui/AJAX/POST question

本文介绍了如何在AJAX中使用POST方法,实现在点击Device Dashboard中的管理按钮时,动态切换到Device Config tab,并根据POST请求展示相应设备配置。展示了相关代码片段和页面加载过程。
摘要由CSDN通过智能技术生成

The templates directory is at the same level as index.php, so ./ is acceptable.  Otherwise, I would see file can't be found errors in Apache.

Is there a way to put the ajax post within the

for the tab references?

Ok, I was able to grab generated source of the pages, so hopefully this will help.  Let me know if there is more you would like to see and I will see what I can come up with.

Here is the main page.

Device Dashboard

$('#dashboardTab').load('./templates/dashboard.tpl.php', function() {});

$('form').submit(function() {

var $theForm = $(this);

console.log($theForm);

$.ajax({

type : "POST",

url : "./templates/mtconfig.tpl.php",

data : $theForm.serialize(),

success : function(returnData) {

console.log("Form sent");

$("#mtConfigTab").html(returnData);

}

});

return false;

}); 

   
Serial NumberLast Check-InManage
1234562013-01-29 12:13:43
6543212013-01-29 12:24:48

$(function() {

$( "#tabs" ).tabs({

active: 0});

});

$('#dashboardTab').load('./templates/dashboard.tpl.php', function() {});

$('form').submit(function() {

var $theForm = $(this);

console.log($theForm);

$.ajax({

type : "POST",

url : "./templates/mtconfig.tpl.php",

data : $theForm.serialize(),

success : function(returnData) {

console.log("Form sent");

$("#mtConfigTab").html(returnData);

}

});

return false;

});

And here is the generated source if you click on one of the forms with name="form_man_1".  When you click the Manage button, it should switch you to the Device Config tab and use the POST to determine which device to display.

Device Dashboard

$(function() {

$( "#tabs" ).tabs({

active: 1});

});

$('form').submit(function() {

var $theForm = $(this);

console.log($theForm);

$.ajax({

type : "POST",

url : "./templates/mtconfig.tpl.php",

data : $theForm.serialize(),

success : function(returnData) {

console.log("Form sent");

$("#mtConfigTab").html(returnData);

}

});

return false;

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值