javascript - How to trigger the event manually once the ajax content's script is executed completely? -


i loading html page script section(render jquery ui) via ajax. html page contains more number widgets. in success function of ajax, accessing ui controls jquery ui class names. none of class names added i.e., script not executed. if access same after 100ms using settimeout working.

please refer below code:

  var self = this;   $.ajax({                 url: url,                 datatype: "html",                 cache: true,                 success: function (str,sta,xhr) {                         $("#samplefile").html(str);               settimeout(function() {                         self.reg($("#samplefile .ui-widgetui"));                     },100);            }         }); 

its working fine want access without settime out. can please suggest on this.

it sounds perhaps trying access dom before initialized. have tried wrapping initialization of ajax request in jquery $(document).ready() call? makes sure dom in initialized state before getting triggered.

https://learn.jquery.com/using-jquery-core/document-ready/


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -