EDIT: I'm wondering if it could have to do with the fact that the url I'm trying to connect to has a # in it. I saw some other posts in my google search for this issue, and some people had a problem with that, but I think that was in jQuery. Here's an example url:
/wps/myportal/!ut/p/c5/04_SB8K8xLLM9MSSzPy8xBz9CP0os3jLwABLU1dTEwMLQyMzA09nnzBLZwtnIwN3M6B8pFm8s7ujh4m5j4GBhZGvsYGRk6mZWZi_ubGBpykFut2NzUC6ccn6mRDQbUJAdzjIr_jdDpI3wAEcDfDqB7ser7yJvp9Hfm6qfkFuaGiEQaanrqOiIgCN4Ys4/dl3/d3/L0lDU0lKSmdrS0NsRUpJQSEvb01vZ0FFSVFoakVLSVFBQkdjWndqSlFRQVFnIS80QzFiOVdfTnIwZ0RFU1pJSlJDSWtmZyEvN185UVA5NUU1NDBPMEg2MElDUjBMMkhCMzBHMC9ZQzJ6SDkzNDA0NzUvaWJtLmludi8xMjc1ODc4NDg0MDU!/#7_9QP95E540O0H60ICR0L2HB30G0
I'm trying to get some dojo/ajax working in a portlet running in WebSphere Portal. I have it working perfectly in Firefox, but when I try in IE 8 (both in compat. mode and not, and in IE7 mode using the debugger) the xhrPost sends back a 404 error. I can paste in the action url into the browser and the right page is shown, so I know that is right. I have tried stepping through the javascript debugger but I get a little lost when it gets into dojo.js. There are just so many attributes and I see everything that should be there (the form, the url, the load function etc) but I just assume they are in the right 'place'. It all seems to be ok until I get to the point where it returns a 404. I have no idea why it's not working in IE but is in FF.
Everything is fine until I get into this code. For testing purposes I've changed the load function to be just an alert, and again - fine in ff, never gets there in ie, just alerts a 404 in the error:
var deferred = dojo.xhrPost({
url: document.getElementById("<%=renderResponse.getNamespace()+PortletConstants.ACTION_URL%>").value,
handleAs: "text",
form: document.getElementById("<portlet:namespace/>showResult"),
load: function(data) {
alert('hi');
},
error: function (data, ioargs){
alert(ioargs.xhr.status)
}
});
Another Edit When I've stepped through the dojo, I get to here:
d._xhrObj = function(){
// summary:
// does the work of portably generating a new
XMLHTTPRequest
// object.
var http = null;
var last_e = null;
if(!dojo.isIE || !dojo.config.ieForceActiveXXhr){
** it gets in here, not sure if that's right or not->** try{ http
= new XMLHttpRequest(); }catch(e){}
}
if(!http){
for(var i=0; i<3; ++i){
var progid = d._XMLHTTP_PROGIDS[i];
try{
http = new ActiveXObject(progid);
}catch(e){
last_e = e;
}
if(http){
d._XMLHTTP_PROGIDS = [progid]; // so
faster next time
break;
}
}
}
if(!http){
throw new Error("XMLHTTP not available: "+last_e);
}
return http; // XMLHTTPRequest instance
}
And then in this xhr.send line is when the 404 comes.
try{
xhr.send(ioArgs.query);
}catch(e){
dfd.cancel();
}