Here is a sample... note it works fine with every browsers except
opera on non 200 responses.  Php code is included in the pre tag.

http://titan.clunet.edu/test.php

On Feb 5, 2:33 pm, Colin Mollenhour <[EMAIL PROTECTED]> wrote:
> A test page would be nice so that I could test it firsthand, but my only 
> other suggestion without seeing it for myself would be to use the X-JSON 
> header for your error codes. If Opera or Prototype does in fact have a 
> problem with responseText in your case, then the X-JSON header will probably 
> still work. I played with this once and can't remember if I tested in Opera 
> or not... It isn't really a fix but it will let you accomplish what you 
> wanted to.  You could also use any other custom header if necessary but be 
> aware of the header size limitations.
> [EMAIL PROTECTED]:Ok i have narrowed it down, when I make an ajax post the 
> page im posting to returns a header and some data. For example if the login 
> was successfuly I may return the session ID or something like that with a 
> header of 200. If the login failed I may return an error code with a header 
> of 400. Now for some reason opera does not get a responseText for anything 
> except 200. I think this is an opera only bug as it works in every other 
> browsers. On Feb 2, 7:55 pm, Colin Mollenhour<[EMAIL PROTECTED]>wrote:Opera 
> 9.10 works fine with Prototype's Ajax.Request. However, in your code it looks 
> like you are checking for responseText inside the onFailure function. Since 
> that function is only called on failure, I wouldn't expect there to be any 
> responseText. I could be wrong since honestly I never use the onFailure 
> function... :-o It sounds like maybe what you want to use are functions for 
> specific failure codes, like on404, etc.. If you are still having problems, 
> I'd check two things: 1) The server is getting the request you think it's 
> getting and the browser is getting the response you think it's getting. 
> Perhaps use a tool like SoftX HTTP Debugger 
> (http://www.softx.org/debugger.html) to inspect the request and response 
> outside the scope of the browser. 2) The code executed on response isn't 
> throwing an exception. The onXXX functions will often give no indication if 
> there is an error in the code that halts execution. Use some code like this 
> to capture those exceptions: function getExceptionDetails(ex){ var message = 
> '<b>'+ex.name+':</b><pre>'+ex.message+'</pre><br/>'+ (ex.fileName && 
> ex.lineNumber ? ex.fileName+' (line <b>'+ex.lineNumber+'</b>)<br/><br/>':'')+ 
> (ex.description ? 'Description:<pre>'+ex.description+'</pre><br/>':'')+ 
> (ex.stack ? 'Stack trace: <pre>'+ex.stack+'</pre><br/>':'')+ (ex.number ? 
> 'Number: '+ex.number+'<br/>':'')+ (ex['opera#sourceloc'] ? 'Location: 
> <b>'+ex['opera#sourceloc']+'</b><br/>':''); return message;} 
> Ajax.Responders.register({ onException: function(request,ex){ new 
> Insertion.Bottom('debug','<hr/><br/>'+getExceptionDetails(ex)+'<br/><br/>')­; 
> } }); [EMAIL PROTECTED]:I have some really simple ajax code that makes a post 
> and then reads the result. Now IE7 IE6 Firefox and Safari all work... however 
> opera returns "" for responseText. I have tried flushing the buffer, 
> different head responses etc but its just doesnt return anything... is this a 
> possible bug in the new opera version (9.10)?new 
> Ajax.Request(window.location, { method: "post", postBody: "pageAction=login" 
> + "&username=" + escape($ ("username").value) + "&password=" + 
> escape($("password").value), onSuccess: function(e) { 
> document.location=document.location; }, onFailure: function(e) { 
> alert("tesT:" + e.responseText); }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to