angularjs - http.jsonp coming back with cached data until manual page refresh -
my data supposed current time i've found when load new data in via $http.jsonp
data comes in cached data every time. how can change unchached data every time?
here's logic test:
$http.jsonp("mydataurl?_jsonp=json_callback").success(function(data){ console.log(data); // logs 0.76608400 1431562002 (only updates when manually refresh page) });
php
<?php echo $_get['_jsonp'] . "(" . microtime() . ")"; ?>
edit
the solution below helper did not solve issue. found code elsewhere specific application causing issue. regardless hope info else out.
you can append random string @ end of url avoid caching.
$http.jsonp("mydataurl?_jsonp=json_callback&random=123").success(function(data){ console.log(data); // logs 0.76608400 1431562002 (only updates when manually refresh page) });
just make sure random has different value everytime. can use date on query "mydataurl?_jsonp=json_callback&random="+new date()
Comments
Post a Comment