2016-04-23 22:16:40 -07:00
|
|
|
$(function() {
|
|
|
|
$("#name").val("");
|
|
|
|
$("#name").keyup(function(e) {
|
|
|
|
if ($(this).val() == "") {
|
|
|
|
$("#name-holder").removeClass("has-success").addClass("has-warning");
|
|
|
|
} else {
|
|
|
|
$("#name-holder").removeClass("has-warning has-error").addClass("has-default");
|
|
|
|
}
|
|
|
|
if (e.keyCode == 13) {
|
|
|
|
send();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
$("#send").click(function(e) {
|
|
|
|
send();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function send() {
|
|
|
|
$("#alert").hide();
|
2016-05-22 11:41:51 -07:00
|
|
|
$("#success").hide();
|
2016-04-23 22:16:40 -07:00
|
|
|
var name = $("#name").val();
|
|
|
|
if (name == "") {
|
|
|
|
$("#name-holder").removeClass("has-warning has-default").addClass("has-error");
|
|
|
|
$("#alert").show().text("Please provide an email address.");
|
|
|
|
} else {
|
2016-05-22 11:41:51 -07:00
|
|
|
route = "/api/v0/register/?email="+name;
|
|
|
|
if(window.location.href.indexOf("forgot") > -1) {
|
|
|
|
route = "/api/v0/forgot/?email="+name;
|
|
|
|
}
|
|
|
|
$.get(route).done(
|
|
|
|
function(data) {
|
|
|
|
$("#input").val("").hide();
|
|
|
|
console.error(data);
|
|
|
|
$("#success").text(data["msg"]).show();
|
|
|
|
}
|
|
|
|
).fail(
|
|
|
|
function(e) {
|
|
|
|
$("#alert").show().text(e.responseText);
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
);
|
2016-04-23 22:16:40 -07:00
|
|
|
}
|
|
|
|
};
|