ajax - How can I handle different json data for each of the jquery tabs? -


i have 3 three (jquery) tabs:

  • overview
  • pricing
  • destination info

each of these tabs have entirely different data. can specify url in href make ajax call. however, how handle data received each of these tabs (so can render them depending on context) ?

should use load event manipulate data ? if so, how can handle on returned json data in load event ?

i have little experience jquery ui, know can data ajax request json (here):

$.ajax({   url: "http://example.com/page.html",   datatype: "json", }).done(function ( data ) {   // stuff data }); 

or use jquery.getjson. there jquery.parsejson.

edit: far can figure out, best you're going get:

$(window).load(function(){     $(function() {         $( "#tabs" ).tabs({             ajaxoptions: {                 error: function( xhr, status, index, anchor ) {                     $( anchor.hash ).html(                         "couldn't load tab. we'll try fix possible. " +                         "if wouldn't demo." );                 },                 success: function( jsonobject, status ) {                         // code                 },                 datatype: "json"             }         });     }); }); 

with this, json need include tab working with. make rather inelegant solution, have switch on tab value returned json. seems though tab api not meant handle display process themselves. see 3 other options: redo tab api yourself; hack api thing; or get_tab_contents.php?tabid=someid&json=somepath


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -