Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a service that sometimes takes awhile to provide a response. I'm trying to capture the initial call to the service so that I can put a "Loading...please wait" message until I get the response. I can't seem to find a way to get at the ajax portion of the HTTP Protocol request. Essentially, I'm looking for something analogous to jquery's ajaxstart. Has anyone done this or know how to do this? I looked into Openlayers event listeners, but couldn't find much there that helped.

var myVectorLayer = new OpenLayers.Layer.Vector("My Vector Layer", {
      projection: "EPSG:4326",
      strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1})],
      protocol: new OpenLayers.Protocol.HTTP({
          url: "./resource/getData.php",
              density: 1
          format: new OpenLayers.Format.JSON(),
       // Over-riding handle Response to get at feature attributes
          handleResponse : function(resp, options)
            var request = resp.priv;                
            if (options.callback)
              if (request.status >= 200 && request.status < 300)
                // success
                if (resp.requestType != "delete") {
                  resp.features = this.parseFeatures(request);
                resp.code = OpenLayers.Protocol.Response.SUCCESS;
              } else
                // failure
                resp.code = OpenLayers.Protocol.Response.FAILURE;
    , resp);


share|improve this question
up vote 1 down vote accepted

Try to use loadstart and loadend events of OpenLayers.Layer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.