0

I use this code to call the controller 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.

TheBoubou
  • 19,487
  • 54
  • 148
  • 236

1 Answers1

5

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);.

Jan Zyka
  • 17,460
  • 16
  • 70
  • 118
  • haaaaa your are right (data and not HTML)! but the result is not perfect. That return the full code of the page (titrel, header, body ...). In the result there is the
    ....
    , I d'like get the content of this . How can I do ?
    – TheBoubou Apr 14 '11 at 13:31
  • This question: http://stackoverflow.com/questions/704679/parse-html-string-with-jquery Seems it doesn't work in some IE version though. Can't think of better idea in the moment – Jan Zyka Apr 15 '11 at 10:08