passing data from php simple dom parser to jquery
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>
精彩评论