jQuery AJAX Tabs post load process -


situation

i have page makes use of tabs. of tabs make use of ajax feature load content. however, response return server not strictly html displayed.

to instantiate tabs, use following , if possible keep processing located in code below due fact 1 part of big frontend automatically creates set of hooks:

objelement.tabs({     heightstyle : "auto",     show : {         effect : "fade",         duration : 400     },     hide : {         effect : "fade",         duration : 400     },     load: function( event, ui) {         /* ### processing here ###         * able pass response "postrequestprocedure"         * function         */     }); } 

jquery tabs throws data straight in tab. know can use load event post processing. here example of server response, json object displayed shown below newline tags. i've left them out legibility.

{     "content" :          "<span><ul><li>list item</li></ul><p>some example html</p></span>",     "script":[         "a.script",         "b.script"     ],     "title":         "user login",     "css": {         "dev.min":"screen"     } } 

problem

  • the ajax properties partly exposed through $tabs({load: function(event,ui)}); interface; cannot access relevant operations/parameters way.

  • when comes time collecting response; if use html(), return closing tags html not part of response. precise, have accounted html in response , these tags not it:

  • if use text() collect contents, opening html tags stripped out

question

how can response without appearing "fiddled" in order parse json object.

possibility

zahid has highlighted can overwrite default ajax behaviour regard tabs. happy if means, can automatically detect conditions such override applies

kind regards

for having same issue me, have figured out without need perform overrides or such like.

quite simply, since api change, undocumented way response follows:

$().tabs({     beforeload: function(event, ui) {         ui.jqxhr.done(function(response) {             console.log(response);         });     } }); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -