在Ajax请求asp.net mvc中找不到页面发现错误

时间:2022-01-21 08:03:31

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

'/'应用程序中的服务器错误。无法找到该资源。说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用。请查看以下网址,并确保拼写正确。

Requested URL: /Contact/PopBid

请求的URL:/ Contact / PopBid

Controller

调节器

[HttpPost]
    public ActionResult PopBid(int jobid)
    {

        var getjob = _context.jobService.GetById(jobid);
        return View();
    }

JavaScript

JavaScript的

      function Singin(jobid) {
            $.fancybox({

                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'easingIn': 'easeOutBack',
                'easingOut': 'easeInBack',
                'width': 850,
                'height': 394,
                href: "/Contact/PopBid",
                data: "jobid=" + jobid,
                'type': 'iframe'
            });
        }s

 <img alt="" onclick="javascript:Singin(@job.ID);" src="/Content/WalkFish/Images/bidimg1.png" style="width: 180px; height: 140px;">

onclick event

onclick事件

pop open well but get error in the pop that

流行开放,但在流行音乐中得到错误

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

'/'应用程序中的服务器错误。无法找到该资源。说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用。请查看以下网址,并确保拼写正确。

Requested URL: /Contact/PopBid

请求的URL:/ Contact / PopBid

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.17929

1 个解决方案

#1


1  

Looks like you are GETing /Contact/PopBid not POSTing to it. Because of the [HttpPost] attribute above you method the GET action is not available.

看起来你正在GETing / Contact / PopBid没有发布到它。由于上面的[HttpPost]属性,因此GET操作不可用。

Change the attribute to [HttpGet]

将属性更改为[HttpGet]

[HttpGet]
public ActionResult PopBid(int jobid)
{

    var getjob = _context.jobService.GetById(jobid);
    return View();
}

#1


1  

Looks like you are GETing /Contact/PopBid not POSTing to it. Because of the [HttpPost] attribute above you method the GET action is not available.

看起来你正在GETing / Contact / PopBid没有发布到它。由于上面的[HttpPost]属性,因此GET操作不可用。

Change the attribute to [HttpGet]

将属性更改为[HttpGet]

[HttpGet]
public ActionResult PopBid(int jobid)
{

    var getjob = _context.jobService.GetById(jobid);
    return View();
}