10

我正在尝试为 Google Chrome 开发一个应用程序:打包应用程序

在我的 apolicação 中,使用以下命令$.get检索 HTML 页面并将其插入当前页面:

页面 HTML

<body>
    <div id="wrap"></div>
</body>

脚本

$.get(url, function(html) {
    $("#wrap").html(html);
});

错误发生在该行:$("#wrap").html(html);

尝试

搜索互联网,我在stackoverflow上找到了这个问题,但这对我没有多大帮助。

另一个细节是这个例子不是 Chrome Web App。同样的例子,完美地发布在互联网上:http ://ridermansb.kodingen.com/

4

1 回答 1

16

如果您的响应是 HTML,请尝试dataType$.get()这样指定:

$.get(url, function(html) {
    $("#wrap").html(html);
}, 'html');

I just had exactly the same problem attaching the response from a jQuery $.post(). The response is HTML but jQuery could not (for whatever reason) correctly determine the data type.

于 2012-01-13T10:16:19.990 回答