How can I get jsonp to play nice with my class?
Posted
by George Edison
on Stack Overflow
See other posts from Stack Overflow
or by George Edison
Published on 2010-05-30T02:22:40Z
Indexed on
2010/05/30
2:32 UTC
Read the original article
Hit count: 298
This whole jsonp thing is quite confusing...
Here is what I want to do:
- I have a class
DataRetriever
- The class has a method
GetData
GetData
makes a jsonp request with the following code:var new_tag = document.createElement('script'); new_tag.type = 'text/javascript'; new_tag.src = 'http://somesite.com/somemethod?somedata'; // Add the element var bodyRef = document.getElementsByTagName("body").item(0); bodyRef.appendChild(new_tag);
Now, the jsonp data from the server somesite.com
can call a function in my code with the data. The problem is, how does the data get delivered to the instance of DataRetriever
that requested it?
I'm really stuck here.
© Stack Overflow or respective owner