Reputation: 199
In my code I have a jquery script which has a next & previous page function. The jquery script loads a php script to parse a selected page. The parsed page has a div removed with the name postsArea and is placed into a div with an id of wrap. As of the moment the jQuery script is set up to put the div postsArea into the div wrap. What I want to do is put the div postsArea into a iframe with the id news.
JQuery :
$('document').ready(function () {
var $wrap = $('#wrap'),
page = 1;
$('#next').on('click', function () {
getPage(++page);
});
$('#prev').on('click', function () {
getPage(--page);
});
var getPage = function (page) {
$wrap.load('proxy.php?page=' + page + ' #postsArea');
};
getPage(page);
});
<?php
include( 'site/simple_html_dom.php');
$html=file_get_html( 'http://roosterteeth.com/home.php?page=' . $_GET["page"]);
echo $html;
?>
<body>
<div id="wrap">
</div>
<button type="button" id="next">Next</button>
<button type="button" id="prev">Previous</button>
</body>
Upvotes: 0
Views: 84
Reputation: 4288
An iframe is basically just a subwindow which is able to perform http queries. You just have to set the "src" attribute of your iframe element value to the right url.
$("iframe").attr("src",'proxy.php?page=' + page + ' #postsArea');
Upvotes: 1