Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$.ajax('login', {
success: function (response) {
var csrf = $('<div/>').append(response).find('input[name="_csrf_token"]').val();
if (!csrf) {
throw 'Failed to parse CSRF value';
$.ajax('login_check', {
type: "POST",
data: {
_username: $('#username').first().val(),
_password: $('#password').first().val(),
_csrf_token: csrf
success: function () {
error: function (xhr) {
var data = $.parseJSON(xhr.responseText);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.