Instantly share code, notes, and snippets.

What would you like to do?
jQuery POST
public ActionResult ConfirmLink(string id)
var confirmationMessage = SomeRepo.ConfirmLink(id);
return Json(new { confirmationMessage = confirmationMessage }, JsonRequestBehavior.AllowGet);
catch (Exception ex)
return new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message);
$.post(uri, postData)
.done(function (response) {
var confirmationMessage = response.confirmationMessage;
// Do something else.
.fail(function (response) {
$('#error-message').html(response.statusText || "Could not link utility account.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment