<html><head><title>Connecting... - ESP Link</title> <link rel="stylesheet" type="text/css" href="/style.css"> <script type="text/javascript" src="140medley.min.js"></script> <script type="text/javascript"> var xhr=j(); function getStatus() { xhr.open("GET", "connstatus.cgi"); xhr.onreadystatechange=function() { if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) { var data=JSON.parse(xhr.responseText); if (data.status=="idle" || data.status=="connecting") { $("#status").innerHTML="Connecting..."; window.setTimeout(getStatus, 1000); } else if (data.status=="got IP address") { $("#status").innerHTML="Connected! Got IP "+data.ip+ ".<br/>" + "If you're in the same network, you can access it <a href=\"http://"+data.ip+ "/\">here</a>.<br/>ESP Link will switch to STA-only mode in a few seconds."; } else { $("#status").innerHTML="Oops: " + data.status + ". Reason: " + data.reason + "<br/>Check password and selected AP.<br/><a href=\"wifi.tpl\">Go Back</a>"; } } } xhr.send(); } window.onload=function(e) { window.setTimeout(getStatus, 2000); }; </script> </head> <body> <div id="main"> <h1>ESP Link - Connecting</h1> <h2>Connecting to AP...</h2> <p>Status: <span id="status">...</span> </p> </div> </body> </html>