Jump to content

jsonp request with jquery


brianlange

Recommended Posts

I am attempting to use the $.getJSON request from jquery to make a jsonp request. I want to use jsonp to circumvent the same origin restriction.

I can't seem to get any data returned. Any help is greatly appreciated.

$.getJSON("http://www.mysite.org/response.php?callback=?",
  function(data) {
      alert(data);
  
  });

 

response.php

$response = array("t" => "test-data"); 

echo "(" . json_encode($response) . ")";

Link to comment
https://forums.phpfreaks.com/topic/236342-jsonp-request-with-jquery/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.