2
我遇到此问题: 我尝试从.json文件加载数据到我的网站,但我遇到了标题中特殊字符的问题(Ó ,Í,É,空间)。我只能更改.HTML文件。我已经tryed这是html的:http://www.lukcian.x10.mx/json5.html
感谢
这是一个例子:
以.json:
{
"Bibliotecas": [
{
"BIBLIOTECA": "Biblioteca General de Navarra ",
"DIRECCIÓN ": "Plaza de San Francisco",
"COD. POSTAL": 31001,
"POBLACIÓN": "Pamplona",
"TELÉFONO": 848427797,
.....................
的.html:
<!DOCTYPE HTML>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<title>JSON multiple zombies
</title>
<script src="HostFiles/jquery.js"></script>
<link href="reset.css" rel="stylesheet" type="text/css" media="screen">
<script>
$(document).ready(function() {
$.getJSON('json/bibliotecas.json', function(json) {
$.each(json.Bibliotecas, function() {
$('<article class="json"></article>').append(
'<p> ' + this.BIBLIOTECA + '</p>' +
'<p> ' + this["DIRECCIÓN "] + '</p>' +
'<p> ' + this.POBLACIÓN + '</p>' +
'<p> ' + this.TELÉFONO + '</p>' +
'</br></br>'
).appendTo('body');
});
});
});
</script>
</head>
<body>
</body>
</html>
结果:
Biblioteca General de Navarra
undefined
undefined
undefined
我有此charset allso tryes。它仍然不起作用 –
当浏览器显示页面时,你可以检查页面源代码的样子吗? –
是的。这是.json文件源代码:http://www.lukcian.x10.mx/json/bibliotecas.json –