Skip to content

Instantly share code, notes, and snippets.

@jotbe
Created September 12, 2011 08:44
Show Gist options
  • Save jotbe/1210855 to your computer and use it in GitHub Desktop.
Save jotbe/1210855 to your computer and use it in GitHub Desktop.
jQuery Ajax
function callAjax(u, d, t) {
jQuery.ajax({
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "html",
type: "POST",
url: u,
data: d,
success: function(msg) {
if(t) {
if(t === ':eval') {
eval(msg);
} else {
jQuery("#" + t).html(msg);
}
}
},
error: function(msg) {
alert('There was an error while processing the request: ' + msg);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment