Skip to content

Instantly share code, notes, and snippets.

@imjacobclark
Created October 4, 2012 22:22
Show Gist options
  • Save imjacobclark/3836852 to your computer and use it in GitHub Desktop.
Save imjacobclark/3836852 to your computer and use it in GitHub Desktop.
Loop
<script>
function goCouch(form){
var xmlHttp = false;
try {
var couchURL = form.databaseUrl.value;
var couchPort = form.portNo.value;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "http://" + couchURL + ":" + couchPort, false );
xmlHttp.send( null );
var couchWelcome = xmlHttp.responseText;
var requestedServerStatus = xmlHttp.status;
var status = document.getElementById("status")
status.innerHTML = couchWelcome;
event.preventDefault()
//alert(requestedServerStatus);
//alert(couchWelcome);
} catch (failed) {
var status = document.getElementById("status")
status.innerHTML = "Coulden't connect to the server there boyo.";
event.preventDefault()
}
var p = couchWelcome;
for (var key in p) {
if (p.hasOwnProperty(key)) {
alert(key + " -> " + p[key]);
}
break;
}
return false;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment