jQuery ajax submittal
Sample example:
js
$.get( "/test" ).then(
function() {
alert( "$.get succeeded" );
}, function() {
alert( "$.get failed!" );
}
);
Rails delete something example. Notice the var that=this
crap.
```js $(document).ready(function(){ $('input[type="submit"]').click(function(){ if(confirm("Are you sure?")){ var that = this;
// Send a delete to the server using jquery ajax
$.ajax("/reminders/" + $(this).data("id"), {"type": 'DELETE'}).then(
function(){
$(that).closest('tr').fadeOut('slow', function(){
$(that).remove();
});
},
function(){
alert("suck it")
}
)
}
return false;
}); }); ```