0

i use jquery post method in site. it's work in localhost but not work in Host.

 $.post('/Home/GetCityLists', null, function (data) {
    var Data = JSON.parse(data);
    for (item of Data) {
        CitiesList.push({ label: item.CityName, value: item.CityId, desc: item.StateName })
    }
});

Controller:

 [HttpPost]
    public string GetCityLists()
    {
        return ConvertToJson(RunSp("MainDB", "Data", "uspGetCitys").Tables["tblCitys"]);
    }

Error in host:

enter image description here POST mysite.com/Home/GetCityLists 500 (Internal Server Error)

5
  • A 500 error means the problem occurred on the server, it's not a JS issue. Given that the problem only appears on your production server it's likely to be a configuration problem. Check your logs for the error and diagnose from there Commented Jun 23, 2017 at 10:16
  • Can you add try-catch block and see what's the exception Internal Server Error throws? Commented Jun 23, 2017 at 10:16
  • Seems this is not the error of jquery, this from server side Commented Jun 23, 2017 at 10:16
  • need to run app or plugin in host? Commented Jun 23, 2017 at 10:20
  • Possible duplicate of How to get data from ASP.NET MVC controller to jQuery dynamically? Commented Jun 23, 2017 at 11:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.