Difference between revisions of "NationStates:Login"

From NSWiki
Jump to: navigation, search
m (data-src)
m
Line 1: Line 1:
<shtml version="2" keyname="afforess" hash="e5edb1d13a71ab5e78d5ca9968dff164d54f68c07501a096c69a152dc576b996"><input id='nation_name' placeholder='Nation Name' type='text' style='width:350px;height:24px;'></input><button class='btn' style='margin-left:5px;margin-top: -3px;' id='nation_enter'>Locate Nation</button>
+
<shtml version="2" keyname="afforess" hash="3b9290fb645a41bae54ce39eb310d182b10b0e2f5f9074354f59e58c2ae95e29"><input id='nation_name' placeholder='Nation Name' type='text' style='width:350px;height:24px;'></input><button class='btn' style='margin-left:5px;margin-top: -3px;' id='nation_enter'>Locate Nation</button>
 
<p id='login_error' style='color:red; font-weight:bold; display:none;'>An Error Occured</p>
 
<p id='login_error' style='color:red; font-weight:bold; display:none;'>An Error Occured</p>
  
Line 14: Line 14:
 
$("#nation_enter").attr("disabled", true);
 
$("#nation_enter").attr("disabled", true);
 
$.get("/nsapi/nation/title/?name=" + encodeURIComponent($("#nation_name").val()), function(data) {
 
$.get("/nsapi/nation/title/?name=" + encodeURIComponent($("#nation_name").val()), function(data) {
$.get("/forums/api.php?action=getUser&value=" + encodeURIComponent($("#nation_name").val()), function(data) {
+
console.log("found nation named " + $("#nation_name").val());
console.log("found user named " + $("#nation_name").val());
+
$("#nation_enter").removeAttr("disabled").hide();
$("#nation_enter").removeAttr("disabled").hide();
+
$("#nation_name").hide()
$("#nation_name").hide()
+
$("#advanced").show();
$("#advanced").show();
+
}).fail(function(jqXHR, textStatus, errorThrown) {
+
$("#login_error").html(jqXHR.responseText).show();
+
$("#nation_verify").removeAttr("disabled");
+
});
+
 
}).fail(function() {
 
}).fail(function() {
 
$("#login_error").html("No Nationstates Nation named " + + $("#nation_name").val() + ".").show();
 
$("#login_error").html("No Nationstates Nation named " + + $("#nation_name").val() + ".").show();

Revision as of 20:24, 22 January 2014