In some part of my code I am sending multiple requests asynchronously to some servers. The problem is: I need some information from the requests (like server address and URL string) in order to process the responses and these informations aren't available in the response parameter (which is something like a GML). That being said, I think the best way is to preset some parameters in the callback function when sending the requests.<br>
<br>I found this solution: <a href="http://openlayers.org/pipermail/users/2009-March/010890.html">http://openlayers.org/pipermail/users/2009-March/010890.html</a> which partially explains OpenLayers.Function.bind() and gives another option of using the scope to set the parameter.<br>
<br>The problem with these solutions is that I need the scope to be on the current object AND set additional parameters. In other words, I CAN'T change the scope, which means either I set these parameters inside the scope in some sort of twisted temporary variables or I use some unknown method which allows me to tell OpenLayers: "When calling the callback function, set these parameters additionally to the response".<br>
<br>This is what I have:<br><br>for (i in servers) {<br> OpenLayers.Request.issue({<br> url: servers[i],<br> headers: {...},<br> params: {...}<br> success: this.someFunction,<br> scope: this<br>
});<br>}<br><br>This is what I need:<br><br>for (i in servers) {<br>
OpenLayers.Request.issue({<br>
url: servers[i],<br>
headers: {...},<br>
params: {...}<br>
success: this.someFunction(i, response), // preset parameter "i"<br>
scope: this<br>
});<br>
}<br><br>Is OpenLayers.Function.bind() what I am looking for? If it is, how do I use it? I didn't find any docs on it, on OL API.<br><br>Thanks in advance.<br>