jQuery Ajax error handling, show custom exception messages

前端 未结 21 2738
滥情空心
滥情空心 2020-11-22 01:50

Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message?

For example, if I want to throw an exception on the server side v

21条回答
  •  孤街浪徒
    2020-11-22 02:32

    In my case, I just removed HTTP VERB from controller.

        **//[HttpPost]**   ---- just removed this verb
        public JsonResult CascadeDpGetProduct(long categoryId)
        {
           
            List list = new List();
            list = dp.DpProductBasedOnCategoryandQty(categoryId);
            return Json(new SelectList(list, "Value", "Text", JsonRequestBehavior.AllowGet));
        }
    

提交回复
热议问题