Created
February 13, 2012 13:43
-
-
Save momchilov/1817049 to your computer and use it in GitHub Desktop.
Sucky javascript.
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
$(document).ready(function() { | |
var loginLink = $("a#login"); | |
var loginWindow = $("div#login"); | |
var loginForm = $('#login-form-dialog'); | |
var submitButton = $('#button-logindialog-submit'); | |
$.fn.submitWithAjax = function() { | |
this.submit(function() { | |
$.post(this.action, $(this).serialize(), null, "script"); | |
return false; | |
}); | |
return this; | |
}; | |
loginLink.click(function () { | |
loginWindow.html('<%= escape_javascript(render :partial => "checkout/login") %>').dialog( | |
function() { | |
submitButton.click(function(){ | |
loginForm.submitWithAjax(); | |
}); | |
} | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment