Example of jQuery getJSON and ajax methods
function getSomething() {
$.getJSON(window.location.href.concat('/getSomething'), function (something) {
$("#something").removeClass('hidden');
$("#something").text(something);
$("#getSomething").remove();
});
});
function getSomething() {
$.ajax({
url: window.location.href + "/getSomething",
type: "GET",
dataType: 'json',
success: function (something) {
$("#something").removeClass('hidden');
$("#something").text(something);
$("#getSomething").remove();
},
error: function (xhr, status, error) {
alert(xhr.responseText);
}
});
}