Ok, unobtrusive javascript time, based on comments for my other answer.
I grabbed this from one of my projects, so you may have to adapt it to your needs, but it should give you an idea of ββwhat to do. jQuery 1.3.2, FYI.
$('form.link_id').livequery('submit', function(){
$.ajax({
url: $(this).attr('action'),
data: $(this).serializeArray(),
type: 'POST',
error: function(xhr, status, error){
alert("Save failed. Please check the form and try again.\n" + (error || status));
},
success: function(content){
},
dataType: 'html'
});
return false;
});
Then the link is pretty simple:
<a href='/resource/new' id='link_id'>
source
share