Revision: 53232
Updated Code
at November 17, 2011 01:34 by nicolaspar
Updated Code
HTML domain1.com <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JsonCrossDomain</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script> </head> <body> <div id="container"></div> <script> $(document).ready( function(){ jQuery.ajax({ url: 'http://domain2.com/test.json', dataType: "script", type: "GET", cache: false, callback: null, data: null }); } ); function getDatosUsuario(datos){ if( confirm('¿Querés ver a quién encontré?') )alert(datos.name); else alert('jodete!'); } </script> </body> </html> JSON, domain2.com getDatosUsuario({ "id": "4", "name": "Mark Zuckerberg", "first_name": "Mark", "last_name": "Zuckerberg", "link": "https://www.facebook.com/zuck", "username": "zuck", "gender": "male", "locale": "en_US" });
Revision: 53231
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 17, 2011 01:32 by nicolaspar
Initial Code
HTML domain1.com <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JsonCrossDomain</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script> </head> <body> <div id="container"></div> <script> $(document).ready( function(){ jQuery.ajax({ url: 'http://domain2.com/test.json', dataType: "script", type: "GET", cache: false, callback: null, data: null }); } ); function getDatosUsuario(datos){ if( confirm('¿Querés ver a quién encontré?') )alert(datos.name); else alert('jodete!'); } </script> </body> </html> JSON, domain2.com getDatosUsuario({ "id": "4", "name": "Mark Zuckerberg", "first_name": "Mark", "last_name": "Zuckerberg", "link": "https://www.facebook.com/zuck", "username": "zuck", "gender": "male", "locale": "en_US" });
Initial URL
Initial Description
If not have access to edit json, setting url possible is: url: 'http://graph.facebook.com/4/?callback=getDatosUsuario'
Initial Title
JS data from json - CrossDomian
Initial Tags
js, jquery, json
Initial Language
PHP