How to get content of a javascript/ajax -loaded div on a site?

后端 未结 5 917
走了就别回头了
走了就别回头了 2021-02-09 13:02

I have a PHP-script that loads page-content from another website by using CURL and simple_html_dom PHP library. This works great. If I echo out the HTML returned I can see the d

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-09 13:31

    you can always bind to the event that is fired when the xhr returns data to the browser and do your operations there.

     var xhReq = createXMLHttpRequest();
     xhReq.open("GET", "ur_php_url.php");
     xhReq.onreadystatechange = onResponse;
     xhReq.send(null);
    
     function onResponse()
     {
     // do the necessary
     }
    

提交回复
热议问题