Ho visto alcuni esempi di dominio incrociato con ajax ma non funziona.cross domain jquery get
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<script type="text/javascript" >
$(document).ready(function() {
var url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=AssasNet&include_rts=1";
$.get(url, function (data) {
console.log(data)
alert(data);
});
});
</script>
</body>
</html>
provo su Chrome e viene dato il seguente errore:
XMLHttpRequest cannot load http://api.twitter.com/1/statuses/user_timeline.json?screen_name=AssasNet&include_rts=1. Origin null is not allowed by Access-Control-Allow-Origin.
Da dove proviene questo esempio? Non è corretto –
Devi configurare il server esterno appositamente per utilizzare AJAX per più domini in questo modo, cosa che non puoi fare qui. [Usa JSON-P invece.] (Http://api.jquery.com/jquery.getJSON/) – Blazemonger
Inoltre c'è solo la dichiarazione. Non una domanda reale. Ho appena suggerito "dov'è l'errore" –