I understand that the key concept behind JSONP is that <script>
tags
are the only elements that bypass javascript same origin policy.
So using these tags we can load third party data disguised as js code.
I don't quite understand how JSONP is used in conjuction with AJAX.
My best guess is that:
when an AJAX call is made under the hoods a <script> tag
elements is actually written in the document on the exact moment the AJAX request has to be made and therefore its result is immediately evaluated.
Can you help me with these also providing a simple example ?
thanks