javascript - jQuery UI AJAX Tabs - first tab doesn't load -


i'm using jquery tabs dynamically load results calculations ajax. works fine except first (default) tab doesn't hit server results... caches first tab's data last set of calculations or blank if first run of session. how force load default tab server?

more detail: have jquery dialog displays loading gif while server doing calculations. when result returned json object, checks if calculation successful , if so, closes loading dialog , opens results dialog. first tab either has old results last calculation or blank if it's first run when dialog opens... know it's not hitting server first tab because "net" tab in firefox's doesn't show activity when dialog pops up, if change tabs , first, ajax requests show in network activity. i'm using tomcat server if that's important.

below code. help!

javascript:

$(document).ready(function () {     $("#loading-dialog").dialog({         autoopen: false,         modal: true,         open: function() {            $.post("run", {              var1: whatever, ...            }).done(function(res) {                 if( parseint(res.status) === 0 ) {                    $("#loading-dialog").dialog("close");                    $("#results-dialog").dialog("open");                 } else {                    alert(res.msg);                 }             }).fail(function(xhr, textstatus, errorthrown) {                 alert('error: '+xhr.responsetext);             })          }     })     $("#results-dialog").dialog({         autoopen: false,         width: 750,             open: function () {                 $("#results-tab").tabs("load", 1); // try force reloading first tab... doesn't work             },         buttons: {             "ok": function() {                 $(this).dialog('close');             }         }     });     $( "#results-tabs" ).tabs({         beforeload: function( event, ui ) {             ui.jqxhr.error(function() {             ui.panel.html("results go here.");         });         }     }); });  

relevant html bits:

<div id="loading-dialog">       <center>please wait, running model.       <img src="${pagecontext.request.contextpath}/images/loading.gif"></center> </div> <div id="results-dialog">     <div id="results-tabs">         <ul>             <li><a href="result?type=one">tab 1</a></li>             <li><a href="result?type=two">tab 2</a></li>             <li><a href="result?type=three">tab 3</a></li>             <li><a href="result?type=four">tab 4</a></li>             <li><a href="result?type=five">tab 5</a></li>             <li><a href="result?type=six">tab 6</a></li>         </ul>     </div> </div> 

your id wrong (missing s) when loading first tab, , jquery tabs zero-indexed following should work:

$("#results-dialog").dialog({        autoopen: false,        width: 750,        open: function () {             $("#results-tabs").tabs("load", 0); // try force reloading first tab... doesn't work         },        buttons: {            "ok": function() {               $(this).dialog('close');           }      }  }); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -