javascriptJavaScript is the language everyone uses without bothering to learn it first, and I'm no exception. I'm trying to set up autorefresh with longpolling. What I have on the client side is the following:
var getAjaxer = function(element) {
return function() {
$.ajax({
url: "/path/to/resource",
success: function(response) {
element.html(response);
},
dataType: "html",
timeout: 10000,
type: "POST",
complete: arguments.callee
});
};
}
var startAjaxing = function() {
myajaxer = getAjaxer($("#myid"));
myajaxer();
}
$(startAjaxing);
thisThis works, but I'm worried I might be doing it all wrong. Could I get some pointers on how I could use the language more effectively?
javascript is the language everyone uses without bothering to learn it first, and I'm no exception. I'm trying to set up autorefresh with longpolling. What I have on the client side is the following:
var getAjaxer = function(element) {
return function() {
$.ajax({
url: "/path/to/resource",
success: function(response) {
element.html(response);
},
dataType: "html",
timeout: 10000,
type: "POST",
complete: arguments.callee
});
};
}
var startAjaxing = function() {
myajaxer = getAjaxer($("#myid"));
myajaxer();
}
$(startAjaxing);
this works, but I'm worried I might be doing it all wrong. Could I get some pointers on how I could use the language more effectively?
JavaScript is the language everyone uses without bothering to learn it first, and I'm no exception. I'm trying to set up autorefresh with longpolling. What I have on the client side is the following:
var getAjaxer = function(element) {
return function() {
$.ajax({
url: "/path/to/resource",
success: function(response) {
element.html(response);
},
dataType: "html",
timeout: 10000,
type: "POST",
complete: arguments.callee
});
};
}
var startAjaxing = function() {
myajaxer = getAjaxer($("#myid"));
myajaxer();
}
$(startAjaxing);
This works, but I'm worried I might be doing it all wrong. Could I get some pointers on how I could use the language more effectively?
Setting up longpolling
javascript is the language everyone uses without bothering to learn it first, and I'm no exception. I'm trying to set up autorefresh with longpolling. What I have on the client side is the following:
var getAjaxer = function(element) {
return function() {
$.ajax({
url: "/path/to/resource",
success: function(response) {
element.html(response);
},
dataType: "html",
timeout: 10000,
type: "POST",
complete: arguments.callee
});
};
}
var startAjaxing = function() {
myajaxer = getAjaxer($("#myid"));
myajaxer();
}
$(startAjaxing);
this works, but I'm worried I might be doing it all wrong. Could I get some pointers on how I could use the language more effectively?