javascript - How can I force my external script to be executed in AJAX response -


my ajax responds

<script type="text/javascript" src="js/checkersgame.js" ></script> 

among other things. works fine, except javascript not executed. how force execute in response?

my ajax follows:

function loadxmldoc() {     var xmlhttp = new xmlhttprequest();     xmlhttp.onreadystatechange = function()     {         if (xmlhttp.readystate == 4 && xmlhttp.status == 200)         {             if (xmlhttp.responsetext == 0) {                 //do nothing             } else {                 document.getelementbyid("everything").innerhtml=xmlhttp.responsetext;             }         }     }     xmlhttp.open("get", "./poll.php", true);     xmlhttp.send(); }  function checkupdate() {     loadxmldoc();     settimeout(checkupdate, 10000); }  checkupdate(); 

if you're trying make ajax call should doing

<script type="text/javascript">  $.ajax({   url: "js/checkersgame.js", }).done(function(reponse) {   //do response (replace content of "everything") });  </script> 

you'll have change xmlhttp.onreadystatechange return new content , change content of "everything" outside checkesgame.js script. might have rework timeout logic well..


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -