Skip to content

Instantly share code, notes, and snippets.

@eventuallyc0nsistent
Created August 30, 2013 20:32
Show Gist options
  • Save eventuallyc0nsistent/6394000 to your computer and use it in GitHub Desktop.
Save eventuallyc0nsistent/6394000 to your computer and use it in GitHub Desktop.
ajax dialog post
var commentPolicy = function(username,category){
var username = username;
var category = category;
$('.icon-comment').click(function() {
var id = $(this).attr('name');
$("#dialog .policy-comment").val('');
$("#dialog").dialog({
title: id+" comment",
buttons: [
{
text : "Submit",
click: function()
{
var comment = $("textarea.span3.policy-comment").val();
$.ajax({
context : this,
url : 'include/sql/admin_policy_comment.php',
type: 'POST',
data : {policy_id : id,username : username ,comment:comment,category:category},
success : function (response) {
$("#dialog .policy-comment").val('');
$("#dialog").dialog("close");
$('#dialog').append(response);
}
})
}
}
],
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment