I have this jQuery to respond to a button being clicked and call a REST method:
$(document).ready(function() {
$(\"#btnGetData\").click(function() {
Try this out, it simply uses vanilla JS to setup your listener then handles the rest with jQuery.
On the test page I made, I was getting my alert just fine.
window.onload = function() {
var btnGetData = document.getElementById('btnGetData')
btnGetData.addEventListener("click", function() {
alert("Twerking...");
var unitval = _unit;
var begdateval = _beginDate;
var enddateval = _endDate;
var model = JSON.stringify({
unit: unitval,
begdate: begdateval,
enddate: enddateval
});
$.ajax({
type: 'GET',
url: '@Url.Action("GetQuadrantData", "LandingPage")',
data: {
unit: unitval,
begdate: begdateval,
enddate: enddateval
},
contentType: 'application/json',
cache: false,
success: function(returneddata) {},
error: function() {
alert('hey, boo-boo!');
}
});
}); // button click
}