0

EDIT: It appears the file jquery.unobtrusive-ajax.js is not being loaded into IE when IE runs. It is on the server and I can see it in the scrips but I can't find it in the IE scripts..

I have searched several links and many have answers of changing the content-type to either text/plain or text/html.

My issue is unique since it only happens on the development server with ie.

Locally with IE and chrome is works fine. On the server with Chrome it works fine, IE it does not.

I am returning a JSON object

C#

return Json(new { success = true, approved = true, redirect = Url.Action("Index", "Dashboard") }, "text/html");

JS

function Redirect(data) {
        debugger;
        data = JSON.parse(data);
        if (data.success) {
            if (data.approved == false) {
                //some code
            }
            else {
                //some code
            }
        }

However all I get on my screen in the JSON object displayed out in plain text..

{"success":true,"approved":true,"redirect":"/Home/Index/"}

I am stumped as to why this is happening. I have tried to change the content type to all different kinds of versions. And this is only happening while running from the server and not locally.

Here is also the responses.

Response

Key Value
Cache-Control   private, s-maxage=0
Content-Type    text/html; charset=utf-8
Date    Fri, 17 Jul 2015 20:54:49 GMT
Response    HTTP/1.1 200 OK
Server  Microsoft-IIS/8.0
Transfer-Encoding   chunked
X-AspNet-Version    4.0.30319
X-AspNetMvc-Version 5.2
X-Powered-By    ASP.NET
X-SourceFiles   =?UTF-8?B?QzpcVXNlcnNccnF1ZWVuXFNWTlxGT09EXEZvb2RBcHA=?=

Request

Key Value
Accept  text/html, application/xhtml+xml, */*
Accept-Encoding gzip, deflate
Accept-Language en-US
Cache-Control   no-cache
Connection  Keep-Alive
User-Agent  Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like     Gecko

Thanks in advance.

2
  • I don't know enough about your specific issue, but I do know that the correct MIME media type for JSON is application/json (src) Jul 17, 2015 at 21:14
  • Yea, I think the issue at hand is the fact that the jquery.unobtrusive file isn't being loaded into IE on the server. It is in chrome and it works there, just not IE. Once that file is loaded back in, keeping the content-type as JSON should work again
    – Robin
    Jul 17, 2015 at 21:17

1 Answer 1

0

As silly as this is..The jquery.unobtrusive-ajax.js file was removed and re added and it works. Such a trivial fix...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.