2012-08-11 17 views
7

tengo este código:Cambio getJSON a JSONP

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script> 
    $(document).ready(function() { 
     $.getJSON('http://example.com/api/get_cats', function(fbResults) { 
      document.write(fbResults.cats[0].title); 
     }); 
    }); 
</script> 

¿Cómo puedo cambiar este código:

<script> 
    $(document).ready(function() { 
     $.getJSON('http://example.com/api/get_cats', function(fbResults) { 
      document.write(fbResults.cats[0].title); 
     }); 
    }); 
</script> 

para que funcione como JSONP ... ¿Es esto totalmente diferente?

+0

¿Los datos ofrecidos por el servidor son JSONP? –

+0

Solo hay datos JSON en el servidor – Satch3000

+3

Entonces no funcionará como una solicitud JSONP. JSONP es básicamente una solicitud '