Reputation: 1520
I want a part of another page with Ajax Loading. When you click on a button. I have a page. But, i want load only the .section div in the page. When i click on the button. Than only the .section page in the other page must be load.
But, how can i load with ajax / jquery. Only a div from a other page.
Upvotes: 0
Views: 1515
Reputation: 21396
You can do this without ajax using jQuery's load
method. With this, you can load the content returned into your #div_id
or body
. Here is an example to load your content into your page's body
;
$("#your_button_id").click(function() {
var myUrl = "yourpage.html #div_id_having_data";
$("body").load(myUrl);
return false;
});
Take a look at the jQuery Ajax/load documentation
Upvotes: 2
Reputation: 5540
If i have understood your question properly, then this would be the solution,
On button click load the whole page (.section should be hidden). Then on click of the other button just toggle the .section div.
Upvotes: 0