Menu

#4 handlerParams substitution

open
nobody
7
2008-03-12
2008-03-12
Shatsar
No

When executing two ajaxRequests in succession with different handlerParameter like these:

loader.doGet(URL_OPERATOR_LIST, null, "operators", true);
loader.doGet(URL_PROPERTIES_LIST, null, "properties", true);

the response handler (for example):
loader.handleResponse = function(parameters){
var id = parameters;
... etc .. etc

receives always id = 'operators'.

i found that the problem is in doGet function (so also doPost is affected) when handler is assigned to event onreadystatechange

i'm fixing it in this way:
i save handlerParameter in AjaxLoader instance before assigning onreadystatechange handler function:

this.lastHandlerParams = handlerParams;

and in onreadystatechange i get it:

dummyThis.handleResponse(dummyThis.lastHandlerParams);

a little code-cleaning and i will be ready to commit a fixed version

Discussion


Log in to post a comment.

MongoDB Logo MongoDB