简体   繁体   中英

Partial View not loading once deployed

I have a MVC 5 web site for Intranet use. On one page there is a Partial View that displays some details of whatever item is selected in a Drop Down List. This all works locally in Development. However, once I deploy the site to our Internal Web Server it no longer does. Everything else still does, Create, Edit, Delete, Details, Index, and a different Partial that loads on the Index page.

This Partial, which loads on the Create page using AJAX and is located in the same folder as Create.cshtml , does not.

Thoughts? I'm not even sure where to look first here...

This is on my Create page and is what loads the Partial, again this works great in local Dev.

<script type="text/javascript">
    $(function () {
        $("#ProductionOrder").change(function () {
            var po = $("#ProductionOrder").val().toString();
            $.get('/wetWashRequests/GetDetails?WONumber=' + po, function (data) {
                $('#ProductionOrderDetails').html(data);
                $('#ProductionOrderDetails').fadeIn('fast');
            });
        })
    })
</script>

If I manually enter the URL displayed in that AJAX into a browser with a valid WONumber it returns the correct data.

This is the Method being called in the Controller:

public PartialViewResult GetDetails(string WONumber)
    {            
        var details = db.vwProductionOrderLookups.Where(x => x.No_ == WONumber).SingleOrDefault();
        return PartialView("_ProductionOrderDetails", details);
    }

EDIT

So, it seems to be related to the URL path. If I change it, in the AJAX call to ServerName/WetWashRequest/WetWashRequests/GetDetails then it works. I'm, guessing, that I deployed it wrong and I should need that extra WetWashRequest in the front....

More than likely, this is caused by how you have your development and production environments in different folders. The biggest problem will be your use of the relative (using / first), or absolute (including the server name in the front). Depending on your environment, make sure that the /wetWashRequests folder or API is on the top level, because that's what the Web Clients are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM