Last active
December 18, 2015 11:49
-
-
Save Maarten88/5778508 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form[data-async=true]').on('submit', function (event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), | |
success: function (data, status) { | |
$target.html(data); | |
} | |
}); | |
event.preventDefault(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Auction.Web.Utility; | |
using System.Web.Mvc; | |
namespace Auction.Web.Controllers | |
{ | |
[AllowAnonymous] | |
public class SiteController : BaseController | |
{ | |
public ActionResult AllowCookies(string ReturnUrl) | |
{ | |
CookieConsent.SetCookieConsent(Response, true); | |
return RedirectToLocal(ReturnUrl); | |
} | |
public ActionResult NoCookies(string ReturnUrl) | |
{ | |
CookieConsent.SetCookieConsent(Response, false); | |
// if we got an ajax submit, just return 200 OK, else redirect back | |
if (Request.IsAjaxRequest()) | |
return new HttpStatusCodeResult(System.Net.HttpStatusCode.OK); | |
else | |
return RedirectToLocal(ReturnUrl); | |
} | |
[OutputCache(Duration = 60 * 60 * 24 * 365, Location = System.Web.UI.OutputCacheLocation.Any)] | |
public ActionResult FacebookChannel() | |
{ | |
return View(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment