I am building a web app that uses alot a jquery including a function that reaches out to a webservice using $.ajax to grab data and return to tdata to the web app.
The function that makes the call is outside the ready block but is called in the ready block to make it run on the load.
After the load I use a timer to keep calling the function to keep things up to date.
But after the first run the function does not seam to work.
This might sound wierd, but the ajax function appears to run after the initial go, but it always returns the original request, it does not make new request to the server.
I use fiddler and watch what going on and after the initial run method it doesnt make any other calls even though I see the ajax method being stepped through using debugging software and see the AJAX call being attempted and returned successfully.
var REQUESTURL = '/citizenQuestionWCF.svc/';
var prOptions = '';
$(document).ready(function () {
getQuestions();
setTimer();
});
function setTimer() {
$(document).everyTime(10000, function () {
getQuestions();
});
}
function getQuestions() {
var url = REQUESTURL + "getPendingQuestions";
$.ajax({
type: "GET",
url: url,
dataType: "json",
success: function (msg) {
var options = '';
options += '<option value="">CLEAR VIEW</option>';
for (cnt = 0; cnt < msg.d.length; cnt++) {
options += '<option value="' + msg.d[cnt][0] + '">' + msg.d[cnt][1] + '</option>';
}
if (options != prOptions) {
$('#questionSelect').html(options);
prOptions = options;
}
}
});
}
any help on this would be greatly appreciated