im new in js,i have created a function and named it ajax handler,what its suppose to it it get the url,get the parameters and return result,please let me know where the problem is coming from,:
in the js file here is the function :
function AjaxHandler(fromDate,toDate,_clickedTurbine,_url) {
var finalresult;
var ajaxCallResult;
$.ajax({
dataType: "json",
type: "POST",
url: _url,
contentType: "application/json; charset=utf-8",
data: JSON.stringify({
"dtFrom": fromDate,
"dtTo": toDate,
"name": _clicked
}),
success: function (result) {
ajaxCallResult = result;
}});
return {
finalresult: ajaxCallResult
}
}
in my view i do like this,but it never reaches my controller to get data and return:
var s=AjaxHandler(dtDrpVals.fromDate, dtDrpVals.toDate, _clicked, "@Url.Action("faultstatistics","Dashbrd")");