Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //run on page load
- $(function(){
- //bind a click event to the nav links
- $("#nav a").bind("click", function(e){
- //keep the links from going to another page by preventing their default behavior
- e.preventDefault();
- //this = link; grab the url
- var pageLocation = this.href;
- //fire off an ajax request
- $.ajax({
- url: pageLocation,
- //passing data
- data: { foo: "bar", something: "else" },
- //defining transport method (it's GET by default anyway, but you could change to post or whatever's relevant)
- type: "GET",
- //on success, set the html to the responsetext
- success: function(data){
- $("#content").html(data.responseText);
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement