Skip to content

Instantly share code, notes, and snippets.

@SergeyNarozhny
Last active August 29, 2015 13:57
Show Gist options
  • Save SergeyNarozhny/9740677 to your computer and use it in GitHub Desktop.
Save SergeyNarozhny/9740677 to your computer and use it in GitHub Desktop.
$.fn.decide = function(options){
this.each(function(){
var settings = $.extend({str: "default"}, options);
var decision = $(this);
var getdata = $.ajax(decision.attr('href'), {
type: 'POST', dataType: 'json', data: decision.data('params')
});
decision.on('click', function(e){
e.preventDefault();
getdata.done(function(result){
if (typeof(result) === "number") {
popup.setContent(settings.str);
popup.params.userid = decision.data("id");
popup.show();
}
});
});
});
};
$(".approve").decide({str: "..."});
$(".reject").decide({str: "..."});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment