Possible Duplicate:
Ways to circumvent the same-origin policy
For example i have a 2 domain “http://domain1.com/info.php” and the other one is “http://domain2.com/script.html“
now the first domain “http://domain1.com/info.php” is releasing json encoded data like this
{
"str_info": [
{
"str_name": "Mark",
"str_age": "22"
},
{
"str_name": "Aliza",
"str_age": "52"
}
]
}
what the second domain “http://domain2.com/script.html” does is to retrieve and manipulate the data given by the first domain.
i don’t know how to connect and retrieve the data came from the first domain which is “http://domain1.com/info.php” to the second domain which is the script.
so can you please show me how using jsonp, jquery, ajax if possible
From jQuery.org
If working crossdomain you can use a method called JSONP
The ajax request adds a parameter
?callback=callbacknameand your server answers withThe function then is executed on your client.
You can use jQuery to get this done very simple
in PHP you would wrap your result like this (simple example)