weixin_33709219 2014-08-07 05:47 采纳率: 0%
浏览 28

MVC-Ajax的HttpPost问题

I have 2 HttpPost. One is called by Json. And another is called when user submits the page.

When User clicks Delete button on page, i call DeletePhone method which deletes the records but problem is it also calls the another [HttpPost](in below code 1st one).

How to stop calling another [HttpPost]?

[HttpPost]
        public ActionResult Phones(Phones model)
        {
            ....
        }

[HttpPost]
        public JsonResult DeletePhone(int documentid)
        {
            string phoneName = Session["PhoneName"].ToString();
            bool result = settings.deletePhone(schemaName);
            return Json(result, JsonRequestBehavior.AllowGet);
        }
  • 写回答

1条回答 默认 最新

  • 衫裤跑路 2014-08-07 05:55
    关注

    I think the problem is that you are taking your delete button as input type submit that is why it is

    submitting the form..Just take it as input type button..

    评论

报告相同问题?