javascript - Code works with alert but not without -


the problem encountering when add alert command code works, if remove it, not work. strange.

how can make work without alert command?

the code below works alert, not without.

  $(function(){                      $('.page-links').click(function() {                       $('#page').load('page' + $(this).data('target') + '.html');                     });       $('[data-target]').on('click', function() {          var navigationnumber = $(this).attr('data-target');                // if , if page18 clicked, run diagram18.js             if (navigationnumber == 18) {                 alert(navigationnumber);                 // run diagram18.js                     $.getscript("sensortables/diagram" + navigationnumber + ".js", function() {                         window['diagram' + navigationnumber]();                     });     });   }); 

sounds asynchronous operation finishing until click ok in alert box, without it runs immediately. have snippet of async bit before?


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -