Although I grasp the concept of jsonp, I am quite intrigued as to why it is not common practice to create an API like the one described below:
What are the reasons (be it security concerns, ease of use, etc.) for avoiding this approach?
The response would be JavaScript containing:
the_var = {"my": "json", "content": 1};
On the client side, the code would appear as follows:
<script>
var the_var;
</script>
<script src="http://www.something.com/json?varname=the_var"></script>
// Now, the_var holds the requested JSON data
While this approach seems logical and works across domains, there must be specific reasons why standard JSONP practices differ. What could those reasons be?