Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
64
rated 0 times [  71] [ 7]  / answers: 1 / hits: 15460  / 11 Years ago, wed, december 18, 2013, 12:00:00

I have a web page, I need part of the content separated to an individual page, but not use iframe. Just like to know if it is possible use div instead of iframe and works as it in the same page(With js base code or php code is cool).



I'd need the whole content of <div class=row-fluid>..</div> to be an individual html, but not use iframe, I will need a div instead of iframe, and make it works like just as in one page.


More From » jquery

 Answers
6

With PHP you can include a page inside your code inside a specific division.



for example inside index.php:



<div>
<?php include('page2.php'); ?>
</div>


and inside page2.php you have:



<span>Hello World</span>


The result would be:



<div>
<span>Hello World</span>
</div>


If what you want to achieve needs to be in the front-end as the user navigates through your site; that is after a click is made to an element and you don't want to change to another page, then AJAX is your option. this example is with Jquery:



$('.clickme').click(function(){
$.ajax({
url:'page2.php'
success:function(msg){
$('#insert_div').html(msg)
}
});
});


HTML:



<span class=clickme>Get Page 2</span>

<div id=insert_div>
<!-- Page 2 will be inserted here -->
</div>


Another solution is Jquery load() as many have posted:



$('.clickme').click(function(){
$('#insert_div').load(page2.php);
});

[#73676] Tuesday, December 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
taliac

Total Points: 84
Total Questions: 114
Total Answers: 114

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
taliac questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Tue, May 12, 20, 00:00, 4 Years ago
Mon, Jan 13, 20, 00:00, 4 Years ago
;