Created
March 1, 2012 07:00
-
-
Save atomize/1947929 to your computer and use it in GitHub Desktop.
jQuery form hijack anchor href (link) ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> | |
<script type="text/javascript" src="http://malsup.github.com/jquery.form.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$('a').bind('click',function(event){ | |
event.preventDefault(); | |
$.get(this.href,{},function(response){ | |
$('#response').html(response) | |
}) | |
}) | |
}); | |
</script> | |
<style type="text/css"> | |
#response { width:100%; height: 400px; background-color:#CCE0FF; overflow-x:hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<div><a href="http://www.github.com"/>Hijack GitHub</a></div> | |
<div id="response"></div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment