I have an ajax response which returns html and javascript as follows:
<div class="contents">
<div>1</div>
<script>
var test = "test";
</script>
</div>
How can I access the variable test?
I have an ajax response which returns html and javascript as follows:
<div class="contents">
<div>1</div>
<script>
var test = "test";
</script>
</div>
How can I access the variable test?
Append the response in some temp div, get the value from variable and remove the div.
$("<div id='dvTemp'></div>").html(AjaxResponse).appendTo("body");
alert(test);
$("#dvTemp").remove();