Angularjs http.jsonp将返回缓存数据,直到手动刷新页面

Angularjs http.jsonp将返回缓存数据,直到手动刷新页面,angularjs,ionic,Angularjs,Ionic,我的数据应该是当前时间,但我发现,当我通过$http.jsonp加载新数据时,我的数据每次都以缓存数据的形式出现。我如何更改它,以便每次都能获取未缓存的数据 这是我的逻辑测试: $http.jsonp("mydataurl?_jsonp=JSON_CALLBACK").success(function(data){ console.log(data); // always logs 0.76608400 1431562002 (only updates when I manually ref

我的数据应该是当前时间,但我发现,当我通过
$http.jsonp
加载新数据时,我的数据每次都以缓存数据的形式出现。我如何更改它,以便每次都能获取未缓存的数据

这是我的逻辑测试:

$http.jsonp("mydataurl?_jsonp=JSON_CALLBACK").success(function(data){
  console.log(data); // always logs 0.76608400 1431562002 (only updates when I manually refresh the page)
});
php

<?php

echo $_GET['_jsonp'] . "(" . microtime() . ")";

?>

您可以在url的末尾添加一个随机字符串,以避免缓存

$http.jsonp("mydataurl?_jsonp=JSON_CALLBACK&random=123").success(function(data){
  console.log(data); // always logs 0.76608400 1431562002 (only updates when I manually refresh the page)
});

只要确保随机数每次都有不同的值。您可能可以在查询中使用日期
“mydataurl?”\u jsonp=JSON\u CALLBACK&random=“+new date()

我添加了“”&u=“+(new date).getTime()@halfer我希望您的所有社区工作都能得到SOF的报酬