Can somebody tell me what's wrong with the following code? It always updates to a new page, instead of the "content" div. Thanks.
This is a test:<br />
<a href="/form" onclick="return updateContent()">Click me</a>
<div id="content">
Update here.
</div>
<script>
function updateContent() {
$.ajax({
type: 'GET',
url: $(this).attr('href'),
success: function(data) {
$('#content').html(data);
};
});
};
</script>