Hello, I have been trying to establish communication with the server through my application. To achieve this, I made a call to the webservice using AJAX. Now, I am looking to incorporate a time interval in AJAX. Can anyone kindly provide guidance on how to do this?
$(document).ready(function () {
$("#btn").attr("disabled", true);
//waitingDialog({});
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var imei2 = '';
imei2 = device.uuid;
checkConnection_inonload(imei2);
}
function checkConnection_inonload(imei2) {
var networkState = navigator.network.connection.type;
alert(networkState);
var states = {};
states[Connection.WIFI] = 'WiFi connection';
if (states[networkState] == 'WiFi connection') {
$.ajax({
cache: false,
async: true,
type: "GET",
dataType: "json",
url: "http://xxxx/Service1.svc/GetKeepMeStatus",
data: {
IMEINO: imei2
},
contentType: "application/json;charset=utf-8",
success: function (r) {
//closeWaitingDialog();
//alert(r);
if (r == "status") {}
});