Created javascript widget. Testing on my own domain and its working fine. However when posting on a 3rd party site it looks like it’s not connecting to the database and getting the data.
Here is the part of the js file where I get the data:
/******* Load HTML *******/
var jsonp_url = "http://www.example.com/widget/data.php";
$.getJSON(jsonp_url, function(data) {
When I test on example.com everything is fine. I set the permissions on data.php to 777 and it still isn’t working. Please help!
You have a variable called
jsonp_url, but the URL you use doesn’t include the stringcallback=?which the documentation says triggers jsonp mode.You need to include that in the URL and make sure that your server side script is outputting JSONP (using
$_GET['callback'](with suitable sanitisation) to determine the function name you wrap the JSON in).