Created
April 10, 2011 22:14
-
-
Save alexschwartz/912787 to your computer and use it in GitHub Desktop.
Ask Jenkins via json using jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>Seitenr?nder - marginwidth, marginheight, topmargin, leftmargin</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var baseUrl; | |
var jobName; | |
$('button').click(function(){ | |
baseUrl = $("#baseUrl").val(); | |
jobName = $("#jobName").val(); | |
jenkinsUrl = baseUrl + "/job/" + jobName + "/api/json?jsonp=?" | |
$("#jobUrl").append(jenkinsUrl) | |
$("#downstream").append("starting request"); | |
$.getJSON(jenkinsUrl, function(json) { | |
$("#downstream").append("got callback: " + json.color); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body marginwidth="50" marginheight="100" topmargin="100" leftmargin="50"> | |
<h3>Input Data</h3> | |
Hudson/Jenkins Base URL: | |
<input type="text" id="baseUrl" value="http://localhost:8080" /><br/> | |
Hudson/Jenkins Job Name: | |
<input type="text" id="jobName" value="green"/><br/> | |
<button>update</button><br /> | |
<h2>Output</h2> | |
<h3>Job URL</h3> | |
<div id="jobUrl"> | |
</div> | |
<h3>Upstream Jobs</h3> | |
<div id="upstream"> | |
</div> | |
<h3>Downstream Jobs</h3> | |
<div id="downstream"> | |
</div> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for sharing