im trying to make a webapp that uses d-pad navigation so i work with keys on keyboard , for some reason i dont want to reload or redirect the page so i just change the content using ajax :
var xhr;
xhr=new XMLHttpRequest();
xhr.open("GET","pages.php?page="+page , false);
xhr.send();
$('body').html(xhr.responseText);
ok it works fine and the content is replaces without problem but the javascript in the content is not executing...
NOTE: the reason i dont want to put javascript in the head section of the page is like i sad im working with keys and on diffrent pages i act diffrent with each keypress ...