javascript XMLHttpRequest open php file and execute more javascript

前端 未结 3 821
北恋
北恋 2020-12-12 03:09

I have a main page, call it Main.php. On this page, is a button that when clicked, sets a div\'s innerHTML (already on Main.php, called divResults) with the results from Re

3条回答
  •  甜味超标
    2020-12-12 03:33

    try to wrap the javascript code from Result.php in a function and call it after inserting it like :

    
    These Are The Results
    

    and

       if (xmlhttp.readyState==4)/* && xmlhttp.status==200) */
        {
            document.getElementById("divResults").innerHTML=xmlhttp.responseText;
            if(result) result();
        }
    

提交回复
热议问题