Skip to content

Instantly share code, notes, and snippets.

@pavelzag
Last active September 5, 2019 19:55
Show Gist options
  • Save pavelzag/0a73fe817aed1d2981db30e53693d6b4 to your computer and use it in GitHub Desktop.
Save pavelzag/0a73fe817aed1d2981db30e53693d6b4 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$("button").click(function() {
var xhr = new XMLHttpRequest();
var url = "http://localhost:8081/trigger_jenkins_job";
var selectedCity = $('#city').val();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var json = JSON.parse(xhr.responseText);
}
};
var data = JSON.stringify({
"city_name": selectedCity
});
xhr.send(data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment