My ajax response seems to evaluate some of the html, but not all of it.
Example: This is the code that replaces a div with the response from the request
eval(document.getElementById("test").innerHTML-xmlhttp.responseText);
This is the response that is plugged in
<Button type="button" onclick="alert("'test'")>test</button>
Basically my problem is that nothing happens when I click that button. I can't get other functions besides alert to work, and I can't get different functions to work either
Any help would be greatly appreciated, Thanks
You have to use =
sign instead of -
to assign the response text to your element. Also instead of onclick="alert("'test'")
, use onclick="alert('test')"
.