JSONP Internet Explorer没有回调

时间:2015-05-07 08:43:56

标签: javascript internet-explorer callback jsonp

除Internet Explorer之外的所有浏览器都正确调用javascript并将其添加到页面中。

我在IE中看到很多关于JSONP问题的帖子,但我没有遇到过这种形式的帖子。为什么函数issuesToList没有被调用?

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <script src="RedmineJSONP.js"></script>
    <title></title>
</head>

<body>
    <header>
        <h1>List of Issues</h1>
    </header>

    <div id="container"></div>
    <script src="http://www.redmine.org/issues.json?callback=issuesToList"></script>

</body>

</html>


function issuesToList(data) {
    var count = data.issues.length;
    for (i = 0; i < count; i++) {
        var issue = data.issues[i];
        loadIssue(issue);
    }
}

//Create an issue instance and append to Ui
function loadIssue(issue){    
    var button = document.createElement("button");
    button.innerHTML = "+";
    button.setAttribute("onClick", "toggleInfo(this)");

    var p = document.createElement("p");

    var item = document.createElement("div");       
    item.setAttribute("id", issue.id);
    item.setAttribute("class", "issue");
    item.appendChild(button);
    item.innerHTML += " " + issue.subject;
    item.appendChild(p);

    var container = document.getElementById("container");
    container.appendChild(item);        
}

EDIT删除了双重http://

0 个答案:

没有答案