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..

    评论

报告相同问题?

悬赏问题

  • ¥15 Cubemax打好的程序无法导入keil中,怎么解决。
  • ¥15 本地部署一个javaweb项目
  • ¥15 Index was outside the bounds of the array
  • ¥15 (标签-Python|关键词-数据类型)(相关搜索:数据类型)
  • ¥15 一个识别内容的自动化脚本程序
  • ¥15 anaconda虚拟python环境部署langchain-chatchat报错
  • ¥20 matlab有约束条件下的多元函数求最小值
  • ¥50 如何隐藏网页弹出框的url地址栏
  • ¥20 metropolis算法模拟二维ising模型来计算磁化强度,fortran
  • ¥15 uniapp-typescript-vue报错