[OSM-dev] Callback parameters

Wyo otto.wyss at orpatec.ch
Tue Dec 21 16:16:36 GMT 2010


I've the following code

     protocol: new OpenLayers.Protocol.XAPI ({
       callback: function (scope, resp) {
         OpenLayers.Util.getElement('doc').innerHTML = "<p>Test=" + resp.code + 
"</p>";
       },
       ...
     }),

and in OpenLayers.Protocol.XAPI the callback is called as

     handleResponse: function (resp, options) {
         var request = resp.priv;
         if (request.status >= 200 && request.status < 300) {
             // success
             resp.code = OpenLayers.Protocol.Response.SUCCESS;
         }else{
             // failure
             resp.code = OpenLayers.Protocol.Response.FAILURE;
         }
         if (this.callback) this.callback.call (options.scope, resp);
     },

yet the "resp.code" is always Null. What's wrong?

See http://www.orpatec.ch/osm/tools/testcanal.php

Wyo




More information about the dev mailing list