I have a json file like this:
{
"nombre": "Jesús Ramírez",
"edad": "25 Años",
"imagen":"file.jpg"
}
I get data from json using jquery function $.getJSON, but I have a problem when I show data in my html document. I do this:
JAVASCRIPT
$.getJSON(file.json, function(data) {
var name= data.nombre;
document.getElementById("student_name").innerHTML=name;
var age= data.edad;
document.getElementById("student_age").innerHTML=age;
var photo= data.imagen;
document.getElementById("student_img");
student_img.src=photo;
});
HTML CODE
<div id="student_name"></div>
<div id="student_age"></div>
<img id="student_img"></img>
But data is showed like this:
- Jes�s Ram�rez
- 25 A�os
I'm using:
<meta charset="utf-8">
and I tried:
<META HTTP-EQUIV= "Content-Type" CONTENT="text/html;charset=ISO-8859-1">
but they don´t work.
Anyone can help me? what can I do to solve this??