Json file:
{
"weather": [
{
"location": "G",
"temp": "9"
},
{
"location": "L",
"temp": "6"
},
{
"location": "W",
"temp": "10"
}
]
}
Script
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
var url = ".../Json.php";
$.getJSON(url + "?callback=?", null, function(weather) {
for(i in weather) {
location = weather[i].location;
temp = weather[i].temp;
$("#footer").append(location.text + temp.text+"<hr />");
}
});
});
// ]]>
</script>
Can somebody show me where I did incorrectly? Is that because the json url I used belongs to different domain ? I tried using jsonp but it still doesn't work,....
Thank you very much.
P/S: Where I got the Jsonp idea Example and I can't configure the server, it's forbidden.