Hi, Your code, as quoted, assumes that the symbols `callbackResponse_1` and `callbackResponse_2` are defined by a scope enclosing your ajaxCall function, as the code you quoted doesn't define them anywhere but the `onSuccess` handler tries to call them. When those symbols are defined (http://jsbin.com/asate3), the code works (including on IE7). When they aren't defined (http://jsbin.com/asate3/2), it fails (with all the browsers I tested -- Chrome, Mozilla, Opera, IE6, IE8...), which makes sense as you're trying to call functions that don't exist. If you set it up to actually call the `callbackResponse` passed into it (http://jsbin.com/asate3/3), it succeeds in calling that (including on IE7) and then fails (of course) to call the non-existant function callbackResponse_1.
Nothing whatsoever to do with XMLHttpRequest. Or Prototype. Am I missing something? -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 1, 4:04 pm, "A.B." <[email protected]> wrote: > Hello everbody! > I want to tell you about a "funny" error I've found making an > Ajax.Request with Internet Explorer 7 and Prototype 1.7. > Please. considering this very standard code: > > function ajaxCall(url, callbackResponse) { > try{ > new Ajax.Request(url, { > method: 'get', > asynchronous: true, > onSuccess: function(transport) { > callbackResponse_1(); > callbackResponse_2(); > } > }); > } catch (exception) { > alert(exception.inspect()); > } > > } > > When trying to execute those lines the Ajax.Request never happened, > not only the callback method, even the very first > "transport.send(url)" never starts. Googling and debugging a bit, I've > found out the root of my problem: > > Basically the cause of bug is the well know poor designed > XMLHttpRequest implementation of IE7 which is really buggy ad won't > work as we expected. Anyway there's is also a prototype issue. In fact > in version 1.7 sources there are these lines of code: > > var Ajax = { > getTransport: function() { > return Try.these( > function() {return new XMLHttpRequest()}, > <------------------------------- > function() {return new ActiveXObject('Msxml2.XMLHTTP')}, > function() {return new ActiveXObject('Microsoft.XMLHTTP')} > ) || false; > }, > > [......] > > that try to create XMLHttpRequest object in a "browser-compatibility" > way. Anyway because IE7 supports XMLHttpRequest, but it's buggy, those > lines force it to use a buggy implementation instead of less-good-but- > working Activex one. > I wouldn't call it a "prototype bug" but it's a fact that at least one > old version (I've seen it on 1.4) had a slightly different > implementation: > > var Ajax = { > getTransport: function() { > return Try.these( > function() {return new ActiveXObject('Msxml2.XMLHTTP')}, > function() {return new ActiveXObject('Microsoft.XMLHTTP')}, > function() {return new XMLHttpRequest()} > <------------------------------- > ) || false; > }, > > which perfectly works with different browser (IE 7/8, FF3, Chrome for > sure). > > I hope that my post will be of help for someone else. > > Best Regards. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
