Ajax doesn't work


#1

I have a simple AJAX call that works fine on localhost but doesn’t when I publish it on GearHost. When I fire the function with the AJAX call, it can’t find the file and I get a 500 Internal Server Error. Here is what the code looks like:

[HttpPost]
public JsonResult AjaxSubmitForm(string formData)
{
// insert code here
}

This code is on the HomeController and the link for the AJAX call looks like this: appname.gearhostpreviewdotcom/Home/AjaxSubmitForm

What am I doing wrong? Is there a specific setting I need to change?


#2

So I just figured out I’m an idiot and the error was caused because I didn’t escape the single quote in my JSON string, yet for some reason I didn’t notice that error when I tried it on localhost. So yeah… mods, please delete this topic and I’m sorry for the inconvenience. :frowning:


#3

No problem at all @zoag. Please let us know if you need anything else!