Skip to content

Instantly share code, notes, and snippets.

@anak10thn
Last active December 10, 2015 08:38
Show Gist options
  • Save anak10thn/4409069 to your computer and use it in GitHub Desktop.
Save anak10thn/4409069 to your computer and use it in GitHub Desktop.
tsubmit
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Ibnu Yahya <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
*/
(function($){
$.fn.tsubmit = function(){
var serialize = (this).serialize();
var action = (this).attr('action');
(this).submit(function(){
$.ajax({
url:action,
type:'POST',
data:serialize,
success:function(msg){
(this).text(msg);
}
});
return false;
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment