Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 弹出MVC4局部视图_Jquery_Asp.net Mvc_Asp.net Mvc 4 - Fatal编程技术网

Jquery 弹出MVC4局部视图

Jquery 弹出MVC4局部视图,jquery,asp.net-mvc,asp.net-mvc-4,Jquery,Asp.net Mvc,Asp.net Mvc 4,我试图弹出部分视图。但它不起作用,也没有击中控制器的方法。 这是我的密码 脚本:- 控制器: [HttpGet] public ActionResult Create(int? id) { db.customers = null; if (Request.IsAjaxRequest()) { return PartialView("_Create", db.customers);

我试图弹出部分视图。但它不起作用,也没有击中控制器的方法。 这是我的密码

脚本:-

控制器:

    [HttpGet]
    public ActionResult Create(int? id)
    {
        db.customers = null;

        if (Request.IsAjaxRequest())
        {
            return PartialView("_Create", db.customers);
        }
        else
        {
            return View(db.customers);
        }
       // return View();
    }

部分视图认为这是一个noraml…

为了让Request.IsAjaxRequest从Ajax请求返回true,您必须包含jQuery unobtrusive Ajax。添加到您的页面。或者添加NuGet包

remove`e.preventDefault()`您是否收到所需URL的警报?请记住,IsAjax不会执行重定向操作
@Html.ActionLink("Create New", "Create", "Customer", null, new { @id = "cusCreate" })
    [HttpGet]
    public ActionResult Create(int? id)
    {
        db.customers = null;

        if (Request.IsAjaxRequest())
        {
            return PartialView("_Create", db.customers);
        }
        else
        {
            return View(db.customers);
        }
       // return View();
    }