Hi, I’m stuck on trying to get an alert to fire with ajax. The action is called with no problem but I must have the success portion of my ajax code written incorrectly because the alert does not happen. My goal is to alert the user based on results from the server. Here’s my ajax call:
var theParms = { selectedDate: "date", testing: "myTester" };
$("#saveBtn").click(function () {
$.ajax({
type: "GET",
url: "/Error/TimeCheck",
data: theParms,
datatype: "html",
success: function (data) {
alert(data);
}
});
});
And the controller action:
public ActionResult Timecheck( string selectedDate, string testing)
{
return Content("hello " + selectedDate);
}
Do I have the success: function(){} written correctly? Any tips would be greatly appreciated. Thanks.