Created
January 28, 2012 13:23
-
-
Save Raynos/1694295 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Billing</title> | |
</head> | |
<body> | |
Enter name on credit card: <input type="text" id="ccName" /><br><br> | |
<button id="submitButton">Submit Payment</button> | |
<script type="text/javascript" src="js/billing-bundle.js"></script> | |
</body> | |
</html> |
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
var Url = require("Url.js").Url, | |
$ = require("jQuery"); | |
$('#submitButton').click(function() { | |
var url = new Url('http://bla.com/process/billing'); | |
var creditCardName = $('#ccName').val(); | |
url.addParameter('name', creditCardName); | |
url.ajax(); | |
} |
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
function log(message) { | |
console.log((new Date()) + ': ' + message); | |
} | |
window.onerror = function(message) { | |
log('Unhandled error: ' + message); | |
} | |
module.exports = { log: log }; |
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
var log = require("common.js").log; | |
function Url(url) { | |
this.url = url; | |
} | |
Url.prototype.addParameter = function(name, value) { | |
this.url += '?' + name + '=' + value; | |
}; | |
Url.prototype.ajax = function() { | |
log('Send ajax to: ' + this.url); | |
}; | |
module.exports = { Url: Url }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment