I'm trying to develop my skills with Ajax I want to change my wrapper content with a different pages wrapper content without having to refresh the page.
I'm using:
$(function () {
$("#page2btn").click(function () {
$.ajax({
url: 'page2.asp',
data: { id: $(this).attr('id') },
success: function (data) {
$('#Wrapper').html(data);
}
});
});
});
<div id="Wrapper">
<div id="menu">
<a class="navbutton" onclick="MakeRequest1()">Home</a> <span class="navbutton">|</span>
<a class="navbutton" id="Page2btn">Page2</a> <span class="navbutton">|</span>
<a class="navbutton" onclick="MakeRequest3()">Page3</a>
</div>
<h1>Test1</h1>
</div>
and another page called page2.asp with a different wrapper content saying Test2 But my wrapper wont change when I click the button. any help would be appreciated.
Test1
to be populated with the new content that is "Test2", right ? – Rahul Gupta Jun 23 '14 at 08:54Test2
I want this to appear on page1 where it saysTest1
without refreshing the page – ByronMcGrath Jun 23 '14 at 09:01