Folks,
To learn Ajax call, I'd like to create a very simple action. It wouldn't take any data, or return any data, it would only return success code. So far, I wrote this:
But I'm having problems with calling this from jQuery. The calling code:Code:public class ProjectController : Controller { // AJAX: /Project/Save public ActionResult Save() { System.Threading.Thread.Sleep(600); // A bit of latency to make the Ajax call more visible to human eye. return new EmptyResult(); } }
Unfortunately, .fail() gets called back.Code:$("button[name='btnSaveProject']").click(function () { console.log("make ajax call"); $.ajax({ url: "/Project/Save", type: "GET", timeout: 8000, cache: false }).done(function () { console.log("ajax call successful"); }).fail(function (jqXHR, textStatus) { console.log("something went awry. " + textStatus); }); });
Any suggestion, insight or reference is really appreciated!
Cheers,
- Nick




Reply With Quote
