Hi all, I'm building an application which uses a jQuery JSONP request across domains. The functionality works fine, but I cannot get it to cache the request. I have used the following, but am wondering what's missing, or if this is not possible?
/* JAVASCRIPT */
$.ajax({
url:"http://cdn.example.com/",
type:'GET',
async: true,
crossDomain:true,
cache:true,
dataType: 'jsonp',
jsonp:'callback',
jsonpCallback:'myCallback',
data:'id='+1,
success: myCallback
});
function myCallback(json){
//do stuff
}
/* PHP */
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/javascript');
$expires = 60*60*24*14;
header("Pragma: public");
header("Cache-Control: maxage=".$expires.", public");
header('Expires:'.gmdate('D, d M Y H:i:s', time()+$expires).' GMT');
$arr = array("123");
echo "myCallback(".json_encode($arr).");";