开发者

passing data from php simple dom parser to jquery

开发者 https://www.devze.com 2023-03-16 19:22 出处:网络
I have this simple script : <?php include_once(\"simple_html_dom.php\"); $content = file_get_html(\'http://en.wikipedia.org/wiki/Myst\');

I have this simple script :

<?php
include_once("simple_html_dom.php");

$content = file_get_html('http://en.wikipedia.org/wiki/Myst');
?>

What I'm trying to do is find a way to send this to a jquery script ....would I need to do a $.ajax GET in jquery? What would I need to add in this script.

I start my jquery code with document.ready....would this need to be chan开发者_开发问答ged?


<?php
if(isset($_GET['getcontent'])){
    include_once("simple_html_dom.php");
    echo file_get_html('http://en.wikipedia.org/wiki/Myst');
}
?>

and

<script type="text/javascript">
$.get("content.php",{"getcontent":"true"},function(data){
    // data is content from php-script
    // do something with it
});
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消