I have the following javascript:
$.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: { email: strEmail, message: strMessage }, success: function(result) { //alert('here'); alert(result.message); }, error: function(error) { alert(error); } });
This makes a call to this function:
public JsonResult Submit(string Email, string Message) { return Json(new { message = "yep" }); }
This works fine in debug mode on the inbuilt webserver.
However, if I go to the virtual dir directly, it does not and hits the error bit. I am attached to the process, and the code behind it never gets hit.
I am using Vista.
Additionally, how do you get the error description in the bit where it says alert(error);
Is your virtual directory at the root of the web server? The path you are supplying is rooted and won’t work if your virtual directory is not at the root.