1 回答

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊
you miss place semicolon in xmlhttp request. please try below code and verify result
<script>
function getRandomVar()
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","demo1.php");
xmlhttp.send();
xmlhttp.onreadystatechange = function()
{
if (this.readyState === 4 && this.status === 200)
{
var result = this.responseText;
alert(result);
//updateBackgroundColor(result);
}
};
}
</script>
添加回答
舉報(bào)