Created
May 20, 2013 20:15
-
-
Save bnadlerjr/5615139 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//= require _jquery-1.9.1.min | |
window.crossDomainPost = function crossDomainPost(success) { | |
var uniqueString = "CHANGE_THIS_TO_SOME_UNIQUE_STRING", | |
$iframe = $('<iframe name=' + uniqueString + '>'), | |
$form = $('<form>'), | |
fields = [ | |
'email', | |
'first_name', | |
'last_name', | |
'password' | |
]; | |
$('body').append($iframe); | |
$('iframe').load(success); | |
// construct a form with hidden inputs, targeting the iframe | |
$form.attr('target', uniqueString); | |
$form.attr('action', "http://dev.unc-mba-prtl-bnadler.2u.com:8080/portal/users"); | |
$form.attr('method', "POST"); | |
//copy parameters from visible form | |
$.each(fields, function (index, field) { | |
var $input = $("<input>"); | |
$input.attr('type', "hidden"); | |
$input.attr('name', field); | |
$input.attr('value', $("input[name=" + field + "]").val()); | |
$form.append($input); | |
}); | |
$('body').append($form); | |
$form.submit(); | |
} | |
$(document).ready(function () { | |
$("#signup").submit(function () { | |
crossDomainPost(function () { | |
window.location = "http://dev.unc-mba-prtl-bnadler.2u.com:8080/#/apply" | |
}); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment