odoe

Error: xhr cancelled in IE8 using esri.request

Discussion created by odoe on Dec 12, 2012
Latest reply on Dec 12, 2012 by odoe
Oddly enough, I just saw this thread right now and found I am having the same error with something I am working on right now, but a different scenario, so I made a new thread.

This only happens in IE8, which is what I need to support in my office. It works fine in Chrome and FF, so I'm not sure what the problem is.

I am using esri.request to submit parameters to a non-arcgis web service. However, in IE8 it is appending the parameters the application pages URL and refreshing the page when I send the request.

I am using a dijit/form to collect and submit data on a (non-submit) dijit.form.button. I can tell it's not the form submitting because I can see my console debugs before the request happens.

Here is the onClick event handler for my form.

_onFlowTraceClick: function(e) {
 e.preventDefault();
 e.stopPropagation();

 var form = registry.byId('flowTraceForm');
 var data = form.getValues();
 console.log('values?', data);
 var _this = this;

 var url = '/csdapi/api/flow/trace';
 var params = {
  id: data.name,
  direction: data.direction,
  districts: data.nodetype === 'districts'
 };

 var len = data.status.length; // an array of checkboxes
 while(len--) {
  params[data.status[len]] = true;
 }

 console.log('params for trace', params); // I see all debug consoles up to here

 var request = esri.request({
  url: url,
  content: params
   });

 request.then(function(response, io) {

  console.log('got a response!', response, io);
  response.bubble = true;
  response.cancelable = true;
  _this.emit('flowTraceResults', response);

 });

}


When it reaches the esri.request() line it appends the parameters to the pages URL, so my app can be http://testgis/demo
and it turns into http://testgis/demo?id=999&nodetype=local&direction=up and my page refreshes. It's just weird.

*edit, it looks like it might be the form.getValues() causing an issue, because the params it adds to my URL match the form and not the custom params I make.

I do have a proxy.ashx set up with mustMatch=false for dev purposes and I can see it working in Chrome and FF.

Has anyone else seen this happen before?

Outcomes