Thursday, 15 March 2012

javascript - Run jQuery code after AJAX jQuery load() -


How can I run the code only after loading all its content from the external page of code 1?

tried the jQuery script

  // filter $ (window) .bund ("load", function () {$ ("filter taken"). ("Click", function () (id = ($ (this) .data ("id") + ''). Partition (','); filter = $ (this) .data ("filter"); $ ("Hotel-list. (" .box "). Hide (); id [0] ==" All "& amp; $ (" # hotel-list .box "). Show () || ID (for Example) (each function (v) {$ ('# hotel-list .box [data -' + filter + '* = "' + v.trim (+ +" '' '')). Show ();}); Return return;});  var two_stars = $ ("article [data-star * = '2']"). Length; var three_s Length = var = $ ("text [data-stars * = '3']"). Length; var four_stars = $ ("text [data-stars * = '4']"). Length; var five_star = $ ("text [Data-stars * = '5'] "). Length; $ ('total- three'). Text (three_star); $ ('total-four'). Text (four_star); $ ('total- Five ') text (five_stars); var sum = three_star + four_star + five_star + two_star; $ ('. Yoga ') text (sum). & Lt;! - calculation board -> length var board_bb = $ ("text [Data-board * = 'no']). Length var board_ro = $ ("text [data-board * = 'cell']"). Length [data-board * = 'breakfast'] "length. Var board_fb = $ (" text [data-board * = 'full board'] "). Length var board_hb = $ (" text [data-board * = 'Half ['] "). Length var board_ai = $ (" Article [data-board * = 'all'] "). Length var board_sc = $ (" text [data-board * = 'self'] ") Length $ ('Total- ro'). Text (board_ro); $ ('.bq-') text (board_bb); $ ('total- fb') text (board_fb); $ ('. Total-HB 'text (board_hb); $ (' total-A ') text (board_ai). $ (' Total-scheduled. ') Text (board_sc). Var total = board_ro + board_bb + board_fb + bor $ ('Total') text (total). // Fixed broken image fixedBrowny images = {Var t = img [i]; if (t.naturalWidth === 0) {// This image has been broken for 0, l = img.length; (; I & lt; l; i ++) T.src = url;}}} Window.onload = function () {fixBrokenImages ('images / noimg.png');}});  

And jQuery's AJAX code is:

  var datastring = location.search; // Now you can update this var and use $ ("# hotel-list"). Load ("Rezults2.php" + datastring + "# hotel-list> *");  

So I want to implement 1 code only after the work of second code (3 to 9 seconds)

Any thoughts on this?

  function runThisAfter () {var two_stars = $ ("article [data-stars * = '.2'] ") Length; Var three_star = $ ("text [data-stars * = '3']"). Length; Var four_star = $ ("text [data-stars * = '4']"). Length; Var five_stars = $ ("text [data-stars * = '5']"). Length; // etc ...} $ ("# Hotel-list"). Load ("Rezults2.php", function () {runThisAfter ();});  

This run will run "runThisAfter ()" upon completion.


No comments:

Post a Comment