Display $.get result in a div
I use this code to call the con开发者_运维知识库troller when I click on the tab. When I click on the second tab, I clear the second and vice versa. The problem, I can't put the result of my $.get in the div (tabs-1 or tabs-2). I see there is a result (data) with firebug
Any idea ?
$("#tabs").bind('tabsselect', function (event, ui) {
switch (ui.index) {
case 0:
$("#tabs-2").empty();
$.post("/Controller/Index", { variable1: 1, variable2: 0 },
function (data) {
$("#tabs-1").text(html);
});
break;
case 1:
$("#tabs-1").empty();
$.post("/Controller/Index", { variable1: 2, variable2: 1 },
function(data){
$("#tabs-2").text(html);
});
break;
}
});
Update1 : In the "data" result there is an ..... I'd like get the content and display it in tabs-2 as HTML. That's means if there are I have the see them.
Isn't it simply a typo? You are using $("#tabs-1").text(html);
where the variable html
doesn't exist. Try $("#tabs-1").text(data);
.
精彩评论