简体   繁体   中英

JSON Not Working on IIS8 Deployed Application

I have a working MVC5 Web application, when am debugging on VS it works perfectly well and pull all Json formatted files to dropdown box very well.

But When I Deployed the application on IIS8 the Json refused to pull to my nested dropdown when choose, So am I missing any configuration for it to work on my localhost(IIS)? I will really appreciate any help thanks.

I checked on my browser debugger and found out that it returning a 404 Not Found error on the javascript console, But this is the same application that am lunching on VS and it working fine... Please am kind of confuse any help please?

Try to use relative path on url from where you have called the function through JSON in your view page.

Like as below:

var urlRelative = '<%= Url.Action("Action", "Controller") %>';
                $.getJSON(urlRelative, function (sourceData) {
                    var select = $("#SourceInfoComboBox1");
                    select.empty();

                    select.append($('<option/>', {
                        value: null,
                        text: "-Select-"
                    }));


$.each(sourceData, function (index, itemData) {
                    select.append($('<option/>', {
                        value: itemData.Value,
                        text: itemData.Text
                    }));
                });

        });

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