2013-03-28 4 views
0

IE7 &을 제외한 모든 브라우저에서 JSON 컨텐츠가로드됩니다. 이유가 무엇인지 모르겠습니다. 다음 코드는 어떤 아이디어입니까? 감사!JSON이 IE7 & 8에로드되지 않습니다.

$(document).ready(function() { 

function loadContent(){ 
    $.ajax({ 
     url: "json/content.json", 
     data: "nocache=" + Math.random(), 
     type: "GET", 
     contentType: "application/json", 
     dataType: "json", 
     success: function(source){ 
      data = source; 
      showStartpage(data); 
      showInfo(data); 
     }, 
     error: function(data){ 
      alert("Failed to load content"); 
     } 
    }); 

} 

function showStartpage(){ 
     $(".start .text3").html(data[lang]['startpage']['text3']); 
     $(".start .text4").html(data[lang]['startpage']['text4']); 
     $(".start .text5").html(data[lang]['startpage']['text5']); 
     $(".start .text6").html(data[lang]['startpage']['text6']); 
     $(".start .text7").html(data[lang]['startpage']['text7']); 
} 

loadContent(); 
showStartpage(); 

} 
+4

F-12를 눌러 디버거를 열고 CONSOLE을보고 오류를 확인하십시오. "작동하지 않음"은 많은 문제를 해결하는 데 도움이되지 않습니다. –

+0

IE7에서는 F-12가 없습니다. – SteveP

+0

대신'cache : false'를 설정하면'data : "nocache ="+ Math.random()'을 포함 할 필요가 없습니다. – Blazemonger

답변

0

코드에 json.js을 포함 시키면 도움이 될 수 있습니다. 이 나를 위해 문제를 해결 추가

$.ajaxSetup({ 
     contentType: "application/json; charset=utf-8" 
}); 

: here에서

다운로드 그것은 제대로 작동하려면 json2.js

0

당신은 순서대로 다음 아약스 설치를 포함 할 필요가 있습니다.

관련 문제