What's the reason i have to use jsonp?
A few days ago i asked why i have no response from a rest server with jquery. The reason was that i must use JSONP. I tested that with a own server and it worked.
Now i have to convince my college's who have control of the right server that the output have to be JSONP instead of json.
Only i don't now exactly why i must use JSONP? And is this only a jquery problem or is it not possible with javascript at all?
Can anyone help me with these questions? Thanks
JSONP is used to get data via AJAX cross-domain. Well, not exactly, JSONP is actually a bit of a "hack".
AJAX requests only work on the same domain, but <script>
tags can be included from any domain. This is what JSONP is, it's actually a Javascript file, that gets added as a <script>
tag.
That's why in JSONP, it's callback({data: value})
, this is a script that gets executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With