Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 22nd, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .attr selector wont work in a each loop?
  2. $.ajax({
  3.       url: 'AEWService.asmx/previewAsset',
  4.       type: "GET",
  5.       contentType: "application/json; charset=utf-8",
  6.       data: json,
  7.       success: function (json) {
  8.           var prevObj = jQuery.parseJSON(json.d);
  9.           setInterval(function () {
  10.               var pId = $('#previewIframe').contents().find('[preview-id]');
  11.               $.each(prevObj, function (i, item) {
  12.                   pId.each(function () {
  13.                       var pElem = this.attr("preview-id");
  14.                       if (pElem == item.Id) {
  15.                           $(this).html(item.Value);
  16.                       }
  17.                   });
  18.               });
  19.           }, 3000);
  20.       }
  21.   });