i am trying to call script alert using ajax for example
i have created two files test1.php and test2.php
here is my code:
test1.php
Change Content
Let AJAX change this text
<script>
<pre><script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "test2.php", true);
xhttp.send();
}
</script>
</pre>
</script>
test2.php
<pre>
<script>alert('hello');</script>
echo "Hello User";
</pre>
the problem is my script tag is not getting called by ajax and is showing blank response . please need your help. Thank You again.