jQuery AJAX request demo
HTML
<a href="#" onclick="return getSuccessOutput();"> make request </a>
<div id="output">waiting for action</div>
CSS
a {
padding: 0.2em;
}
a:hover {
background-color: #02AAEE;
}
#output {
display: block;
margin-top: 8px;
padding: 1%;
border: 1px solid #666;
background-color: #efefef;
}
JavaScript
// handles the click event, sends the query
function getSuccessOutput() {
$.ajax({
type: "DELETE",
crossDomain: true,
url:'http://localhost:65445/api/json/v1/jobs/20181216-195117-270-5355A49682BE',//repalce this by valid jobid
complete: function (response) {
$('#output').html("answer is in my case empty, if you see something you cant reproduce the problem:[" +response.responseText + "]");
},
error: function (response) {
$('#output').html('Bummer: ' + response);
},
});
return false;
}