var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');script.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
document.getElementsByTagName('head')[0].appendChild(script);
$(function() {
var host =$(location).attr('host');
var json = {
"bwired": {
"sites": [{
"domain": "http://jsfiddle.net",
"server": "blah"},
{
"domain": "http://johnkolovos.blogspot.com",
"server": "sleeps.on.my.server",
}]
}
};
$.each(json.bwired.sites, function(i, v) {
if (v.domain == "http://"+host) {
alert(host + " lives on: "+ v.server);
return;
}
});
});
script.setAttribute('type', 'text/javascript');script.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
document.getElementsByTagName('head')[0].appendChild(script);
$(function() {
var host =$(location).attr('host');
var json = {
"bwired": {
"sites": [{
"domain": "http://jsfiddle.net",
"server": "blah"},
{
"domain": "http://johnkolovos.blogspot.com",
"server": "sleeps.on.my.server",
}]
}
};
$.each(json.bwired.sites, function(i, v) {
if (v.domain == "http://"+host) {
alert(host + " lives on: "+ v.server);
return;
}
});
});
http://api.jquery.com/jQuery.getJSON/
ReplyDeleteThis comment has been removed by the author.
ReplyDelete