Hi Jason, > > the way you write it is good even in IE. > > When write " onComplete: parent_response() ", you launch the function > > at initialisation time, and the AJAX was not call, so you input is > > undefined. If you test alert(originalRequest) you should also have > > undefined. > > When should this be launched, then? I thought onComplete called the > callback function after the entire ajax call had completed, regardless > of success/failure ?
In fact by writting parent_response(), it indicate that you execute the function on the creation of the AJAX request, and the retruned of the execution of the function value will be used for the onComplete. So the onComplete value will be uindefined (as you return nothing in the function). By setting parent_response, you copy the function definition to the onComplete parameter. This is the big difference. > > For your trouble, what is the response text of the AJAX request ?? > > you should check it too, in case xML was not recognize by IE and set > > as text. > > It definitely returns XML .. It's something like this : > > <Departments> > <ou name='foo' value='bar' /> > <ou name='baz' value='qux' /> > </Departments> The originalRequest in your parent_response function is in fact an response Object, go and see the API doc at http://prototypejs.org/api/ajax/response If the originalRequest.text value inside the function is your XML document, it should be a problem in header not recognize by IE. in that case, you should create an XML document by yourself with the returned text or modify header. One thougth, is it a well formed XML, beginning with <xml ...> asthe root tag ? it could also be a reason. To know what contain originalRequest just paste on this thread the retruned value of: $H(originalRequest).inspect(). We will have all info on that object. -- david On 17 sep, 16:56, Jason Frisvold <[email protected]> wrote: > On 09/17/2009 07:14 AM, david wrote: > > > > > Hi Jason, > > > the way you write it is good even in IE. > > When write " onComplete: parent_response() ", you launch the function > > at initialisation time, and the AJAX was not call, so you input is > > undefined. If you test alert(originalRequest) you should also have > > undefined. > > When should this be launched, then? I thought onComplete called the > callback function after the entire ajax call had completed, regardless > of success/failure ? > > > For your trouble, what is the response text of the AJAX request ?? > > you should check it too, in case xML was not recognize by IE and set > > as text. > > It definitely returns XML .. It's something like this : > > <Departments> > <ou name='foo' value='bar' /> > <ou name='baz' value='qux' /> > </Departments> > > The parent_response function will parse that, create what I need, and > display it. The problem is, originalRequest doesn't seem to get set, or > if it does, it's not by what I'm expecting. > > Should I call the AJAX some other way instead of via the body onload? > > > > > -- > > david > > > On 16 sep, 23:26, Jason Frisvold <[email protected]> wrote: > >> Hi, > > >> I'm running into a problem with IE8 and responseXML. Code follows > >> : > > >> var url = 'http://example.com/myfile.php'; > > >> function update_parent() { > >> var root = 1; > >> var myAjax = new Ajax.Request(url, > >> { > >> method: 'get', > >> parameters: {parent_id: root}, > >> onComplete: parent_response > >> } > >> ); > > >> } > > >> // ------------------------------------------------------- > > >> function parent_response(originalRequest) { > >> var domObj = originalRequest.responseXML; > >> alert(domObj); > > >> } > > >> This is all fired off via a <body onload='update_parent'> > > >> This works perfectly in Firefox. However, in IE8, it is failing with no > >> errors. The alert in parent_response() does not get triggered in IE8. > > >> If I change the onComplete: to read : > > >> onComplete: parent_response() > > >> Then the alert triggers, but it pops up as undefined. How do I properly > >> handle this so it works cross-browser? ie, what object should I be > >> sending to get to the responseXML value? > > >> Thanks, > > >> -- > >> --------------------------- > >> Jason Frisvold > >> [email protected] > >> --------------------------- > >> "I love deadlines. I like the whooshing sound they make as they fly by." > >> - Douglas Adams > > -- > --------------------------- > Jason Frisvold > [email protected] > --------------------------- > "I love deadlines. I like the whooshing sound they make as they fly by." > - Douglas Adams --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
