AppMobi .device.getRemoteData is caching
I am using AppMobi.device.getRemoteData method to get data from a webservice which i have hosted on a public server. this webservice returns a random number every time i access it.
When i am testing my application on simulator in XDK ( in chrome ) i get random number every time.
But while testing the application on my iPad using "test anywhere" feature, i get the random value first time and then i get the same value f开发者_如何学Cor the subsequent requests. it seems some things is being cached while testing on iPad which i am not able to figure out.
Any help on this issue will be much appreciated .
i have pasted my code below.
Thanks in advance, Ashish
getValue = function () {
AppMobi.device.getRemoteData("http://122.181.151.75/DwebMobile/RandomNumService.svc/GetRandomValue", "GET", "", "success_handler", "error_handler");
}
function success_handler(data) {
var ret = JSON.parse(data);
var canvas = document.getElementById('id1');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
drawShape();
ctx.fillStyle = '#FF0000';
ctx.font = 'italic 12px sans-serif';
ctx.textBaseline = 'top';
ctx.fillText(ret.d, 22, 70);
}
AppMobi.Cache.clearAllCookies();
}
function error_handler(data) { alert("error: " + data); }
<body>
<button id="btnBeep" ontouchstart="getValue();">
Get Value</button>
<canvas id="id1"></canvas>
</body>
We tested a basic random number web service call in App*lab. AppMobi.device.getRemoteData is NOT caching results, so the error is in your javascript code.
Ian
精彩评论