Terry Riegel
2007-Jun-09 13:18 UTC
AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
Hello all, I have been developing some ajax stuff all week. Just this morning the ajax calls quit working in Safari, and Firefox. I backed out to a last known working state and they still were not working, so I added some handlers to see if I could sniff out the problem. ... onException: function(transport){$ ("serversaid").innerHTML=transport.toJSONString();}, onFailure: function(){alert("12");}, onLoading: function(){alert("13");}, ... The onException never triggered on Safari, but it did in Firefox. The onLoading still triggers just fine. Here is the toJSONString from the onException. {"transport":{},"options": {"method":"get","asynchronous":true,"contentType":"application/x-www- form-urlencoded","encoding":"UTF-8","parameters": {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"roo t","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"htmlos _login_username"}},"url":"http://clearimageonline.com/pages/htmlos/ 56272.1.238091707826617413? submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&htmlos_log in_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username","method ":"get","parameters": {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"roo t","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"htmlos _login_username"}} I am not sure what this means or how to proceed. Is there additional debugging techniques I could use. Thanks for any help, Terry Riegel --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Terry Riegel
2007-Jun-11 11:13 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
Hello, Maybe I need to simplify my question, or ask a related question that might help me come to a solution on my original question. From the prototype API instructions I read one of the common callbacks to the ajax functionality is... ----- onException Triggered whenever an XHR error arises. Has a custom signature: the first argument is the requester (i.e. an Ajax.Request instance), the second is the exception object. ----- What is confusing me about this description is "the first argument is the requester (i.e. an Ajax.Request instance), the second is the exception object." What is the proper syntax to see the first or second argument? Would it be something like... onException: function(a,b){alert(''first argument:''+a+'' second argument:''+b);} For me to handle the onException callback I need to know what it is sending back and how to reference the information it is sending so that I can formulate somse sort of response. Any help will be greatly appreciated Terry On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote:> Hello all, > > I have been developing some ajax stuff all week. Just this morning > the ajax calls quit working in Safari, and Firefox. I backed out to > a last known working state and they still were not working, so I > added some handlers to see if I could sniff out the problem. > > ... > onException: function(transport){$ > ("serversaid").innerHTML=transport.toJSONString();}, > onFailure: function(){alert("12");}, > onLoading: function(){alert("13");}, > ... > > > The onException never triggered on Safari, but it did in Firefox. > The onLoading still triggers just fine. Here is the toJSONString > from the onException. > > {"transport":{},"options": > {"method":"get","asynchronous":true,"contentType":"application/x- > www-form-urlencoded","encoding":"UTF-8","parameters": > {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"r > oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"ht > mlos_login_username"}},"url":"http://clearimageonline.com/pages/ > htmlos/56272.1.238091707826617413? > submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&htmlos_l > ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username","me > thod":"get","parameters": > {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"r > oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"ht > mlos_login_username"}} > > I am not sure what this means or how to proceed. Is there > additional debugging techniques I could use. > > Thanks for any help, > > > Terry Riegel > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Jun-11 13:45 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
The first argument is the actual Ajax.Request object that originally generated the exception. That way you can get at information like the readyState, the url that it was trying to connect to, etc. The second argument is the exception object, which contains information like the error message that was generated by the browser, the error codes, etc. Each argument can help you in different ways. Perhaps, you could try the request again to see if it fails a second time, and for this, you''d need to access properties and methods of the first argument. But, if you wanted to display an error message to the visitor of your site and ask them to try and fix the problem (if possible) then you''re going to want to access methods and properties of the second argument. Does that help? - Dash - Terry Riegel wrote:> Hello, > > Maybe I need to simplify my question, or ask a related question that > might help me come to a solution on my original question. > > From the prototype API instructions I read one of the common > callbacks to the ajax functionality is... > > ----- > onException > > Triggered whenever an XHR error arises. Has a custom signature: the > first argument is the requester (i.e. an Ajax.Request instance), the > second is the exception object. > ----- > > What is confusing me about this description is "the first argument is > the requester (i.e. an Ajax.Request instance), the second is the > exception object." > > What is the proper syntax to see the first or second argument? Would > it be something like... > > onException: function(a,b){alert(''first argument:''+a+'' second > argument:''+b);} > > For me to handle the onException callback I need to know what it is > sending back and how to reference the information it is sending so > that I can formulate somse sort of response. > > Any help will be greatly appreciated > > > Terry > > > > > > On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote: > > >> Hello all, >> >> I have been developing some ajax stuff all week. Just this morning >> the ajax calls quit working in Safari, and Firefox. I backed out to >> a last known working state and they still were not working, so I >> added some handlers to see if I could sniff out the problem. >> >> ... >> onException: function(transport){$ >> ("serversaid").innerHTML=transport.toJSONString();}, >> onFailure: function(){alert("12");}, >> onLoading: function(){alert("13");}, >> ... >> >> >> The onException never triggered on Safari, but it did in Firefox. >> The onLoading still triggers just fine. Here is the toJSONString >> from the onException. >> >> {"transport":{},"options": >> {"method":"get","asynchronous":true,"contentType":"application/x- >> www-form-urlencoded","encoding":"UTF-8","parameters": >> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"r >> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"ht >> mlos_login_username"}},"url":"http://clearimageonline.com/pages/ >> htmlos/56272.1.238091707826617413? >> submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&htmlos_l >> ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username","me >> thod":"get","parameters": >> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username":"r >> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":"ht >> mlos_login_username"}} >> >> I am not sure what this means or how to proceed. Is there >> additional debugging techniques I could use. >> >> Thanks for any help, >> >> >> Terry Riegel >> >> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Terry Riegel
2007-Jun-11 16:40 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
David, Thanks for your reply. What I still don''t get is the syntax to do that. I want to see the first argument. How would I use alert(); to see its value? Terry On Jun 11, 2007, at 9:45 AM, David Dashifen Kees wrote:> > The first argument is the actual Ajax.Request object that originally > generated the exception. That way you can get at information like the > readyState, the url that it was trying to connect to, etc. The second > argument is the exception object, which contains information like the > error message that was generated by the browser, the error codes, etc. > Each argument can help you in different ways. Perhaps, you could try > the request again to see if it fails a second time, and for this, > you''d > need to access properties and methods of the first argument. But, if > you wanted to display an error message to the visitor of your site and > ask them to try and fix the problem (if possible) then you''re going to > want to access methods and properties of the second argument. > > Does that help? > > - Dash - > > Terry Riegel wrote: >> Hello, >> >> Maybe I need to simplify my question, or ask a related question that >> might help me come to a solution on my original question. >> >> From the prototype API instructions I read one of the common >> callbacks to the ajax functionality is... >> >> ----- >> onException >> >> Triggered whenever an XHR error arises. Has a custom signature: the >> first argument is the requester (i.e. an Ajax.Request instance), the >> second is the exception object. >> ----- >> >> What is confusing me about this description is "the first argument is >> the requester (i.e. an Ajax.Request instance), the second is the >> exception object." >> >> What is the proper syntax to see the first or second argument? Would >> it be something like... >> >> onException: function(a,b){alert(''first argument:''+a+'' second >> argument:''+b);} >> >> For me to handle the onException callback I need to know what it is >> sending back and how to reference the information it is sending so >> that I can formulate somse sort of response. >> >> Any help will be greatly appreciated >> >> >> Terry >> >> >> >> >> >> On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote: >> >> >>> Hello all, >>> >>> I have been developing some ajax stuff all week. Just this morning >>> the ajax calls quit working in Safari, and Firefox. I backed out to >>> a last known working state and they still were not working, so I >>> added some handlers to see if I could sniff out the problem. >>> >>> ... >>> onException: function(transport){$ >>> ("serversaid").innerHTML=transport.toJSONString();}, >>> onFailure: function(){alert("12");}, >>> onLoading: function(){alert("13");}, >>> ... >>> >>> >>> The onException never triggered on Safari, but it did in Firefox. >>> The onLoading still triggers just fine. Here is the toJSONString >>> from the onException. >>> >>> {"transport":{},"options": >>> {"method":"get","asynchronous":true,"contentType":"application/x- >>> www-form-urlencoded","encoding":"UTF-8","parameters": >>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username": >>> "r >>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":" >>> ht >>> mlos_login_username"}},"url":"http://clearimageonline.com/pages/ >>> htmlos/56272.1.238091707826617413? >>> submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&htmlos >>> _l >>> ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username"," >>> me >>> thod":"get","parameters": >>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username": >>> "r >>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":" >>> ht >>> mlos_login_username"}} >>> >>> I am not sure what this means or how to proceed. Is there >>> additional debugging techniques I could use. >>> >>> Thanks for any help, >>> >>> >>> Terry Riegel >>> >>> >> >> >>> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Jun-11 17:07 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
The arguments are objects, not really values. For example, the first argument is an instance of the Ajax.Request object that created the exception. Let''s assume that we named that argument "xhr" like this: onException: function(xhr, ex) { /* ... do something */ } Now, saying alert(xhr) will most likely say "Object" or something useless like that. But if we do something like this: alert(xhr.options.method); should result in either "get" or "post" (or "delete" or "push" if you''re using them) since we''re now accessing a specific property of the options object within the xhr object. The exception object, the second argument which I named "ex" above, is an object that can tell you information about the specific error that has occurred. The object has two properties named number and description, if I remember correctly. Therefore, like above, if you just alert(ex) you''ll get "Object" but if you alert(ex.description) the error message within the Error object should be alerted to the user. Does this help? - Dash - Terry Riegel wrote:> David, > > Thanks for your reply. What I still don''t get is the syntax to do > that. I want to see the first argument. How would I use alert(); to > see its value? > > Terry > > > > On Jun 11, 2007, at 9:45 AM, David Dashifen Kees wrote: > > >> The first argument is the actual Ajax.Request object that originally >> generated the exception. That way you can get at information like the >> readyState, the url that it was trying to connect to, etc. The second >> argument is the exception object, which contains information like the >> error message that was generated by the browser, the error codes, etc. >> Each argument can help you in different ways. Perhaps, you could try >> the request again to see if it fails a second time, and for this, >> you''d >> need to access properties and methods of the first argument. But, if >> you wanted to display an error message to the visitor of your site and >> ask them to try and fix the problem (if possible) then you''re going to >> want to access methods and properties of the second argument. >> >> Does that help? >> >> - Dash - >> >> Terry Riegel wrote: >> >>> Hello, >>> >>> Maybe I need to simplify my question, or ask a related question that >>> might help me come to a solution on my original question. >>> >>> From the prototype API instructions I read one of the common >>> callbacks to the ajax functionality is... >>> >>> ----- >>> onException >>> >>> Triggered whenever an XHR error arises. Has a custom signature: the >>> first argument is the requester (i.e. an Ajax.Request instance), the >>> second is the exception object. >>> ----- >>> >>> What is confusing me about this description is "the first argument is >>> the requester (i.e. an Ajax.Request instance), the second is the >>> exception object." >>> >>> What is the proper syntax to see the first or second argument? Would >>> it be something like... >>> >>> onException: function(a,b){alert(''first argument:''+a+'' second >>> argument:''+b);} >>> >>> For me to handle the onException callback I need to know what it is >>> sending back and how to reference the information it is sending so >>> that I can formulate somse sort of response. >>> >>> Any help will be greatly appreciated >>> >>> >>> Terry >>> >>> >>> >>> >>> >>> On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote: >>> >>> >>> >>>> Hello all, >>>> >>>> I have been developing some ajax stuff all week. Just this morning >>>> the ajax calls quit working in Safari, and Firefox. I backed out to >>>> a last known working state and they still were not working, so I >>>> added some handlers to see if I could sniff out the problem. >>>> >>>> ... >>>> onException: function(transport){$ >>>> ("serversaid").innerHTML=transport.toJSONString();}, >>>> onFailure: function(){alert("12");}, >>>> onLoading: function(){alert("13");}, >>>> ... >>>> >>>> >>>> The onException never triggered on Safari, but it did in Firefox. >>>> The onLoading still triggers just fine. Here is the toJSONString >>>> from the onException. >>>> >>>> {"transport":{},"options": >>>> {"method":"get","asynchronous":true,"contentType":"application/x- >>>> www-form-urlencoded","encoding":"UTF-8","parameters": >>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username": >>>> "r >>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":" >>>> ht >>>> mlos_login_username"}},"url":"http://clearimageonline.com/pages/ >>>> htmlos/56272.1.238091707826617413? >>>> submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&htmlos >>>> _l >>>> ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username"," >>>> me >>>> thod":"get","parameters": >>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username": >>>> "r >>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST":" >>>> ht >>>> mlos_login_username"}} >>>> >>>> I am not sure what this means or how to proceed. Is there >>>> additional debugging techniques I could use. >>>> >>>> Thanks for any help, >>>> >>>> >>>> Terry Riegel >>>> >>>> >>>> >>> >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Terry Riegel
2007-Jun-11 17:56 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
David, Yes, that is very helpful. I appreciate you taking the time to explain it to me. What is still confusing to me is the documentation. Is this a deficiency in documentation (from the main prototype site). Or is the deficiency in my understanding (I assume its the latter). In other works where did you come to this knowledge you have? As I read the documentation I don''t see that information. Can you suggest some articles that would help bolster my understanding so that the API to prototype would be more useful to me. I think the main thing you said that has helped me is this... If a callback has two arguments I can create an anonymous function like... onException: function (param1,param2) { // The callback arguments are param1, and param2 (they are most likely objects) // I could use json to string to see what the objects have in them } Is this a correct understanding or am I missing the boat somewhere? Once again, thanks for taking the time to help me with this. I can appreciate that it may be frustrating for you to have to baby step me through this. Terry Riegel On Jun 11, 2007, at 1:07 PM, David Dashifen Kees wrote:> > The arguments are objects, not really values. For example, the first > argument is an instance of the Ajax.Request object that created the > exception. Let''s assume that we named that argument "xhr" like this: > > onException: function(xhr, ex) { > /* ... do something */ > > } > > Now, saying alert(xhr) will most likely say "Object" or something > useless like that. But if we do something like this: > > alert(xhr.options.method); > > should result in either "get" or "post" (or "delete" or "push" if > you''re > using them) since we''re now accessing a specific property of the > options > object within the xhr object. > > The exception object, the second argument which I named "ex" above, is > an object that can tell you information about the specific error that > has occurred. The object has two properties named number and > description, if I remember correctly. Therefore, like above, if you > just alert(ex) you''ll get "Object" but if you alert(ex.description) > the > error message within the Error object should be alerted to the user. > > Does this help? > > - Dash - > > Terry Riegel wrote: >> David, >> >> Thanks for your reply. What I still don''t get is the syntax to do >> that. I want to see the first argument. How would I use alert(); to >> see its value? >> >> Terry >> >> >> >> On Jun 11, 2007, at 9:45 AM, David Dashifen Kees wrote: >> >> >>> The first argument is the actual Ajax.Request object that originally >>> generated the exception. That way you can get at information >>> like the >>> readyState, the url that it was trying to connect to, etc. The >>> second >>> argument is the exception object, which contains information like >>> the >>> error message that was generated by the browser, the error codes, >>> etc. >>> Each argument can help you in different ways. Perhaps, you could >>> try >>> the request again to see if it fails a second time, and for this, >>> you''d >>> need to access properties and methods of the first argument. >>> But, if >>> you wanted to display an error message to the visitor of your >>> site and >>> ask them to try and fix the problem (if possible) then you''re >>> going to >>> want to access methods and properties of the second argument. >>> >>> Does that help? >>> >>> - Dash - >>> >>> Terry Riegel wrote: >>> >>>> Hello, >>>> >>>> Maybe I need to simplify my question, or ask a related question >>>> that >>>> might help me come to a solution on my original question. >>>> >>>> From the prototype API instructions I read one of the common >>>> callbacks to the ajax functionality is... >>>> >>>> ----- >>>> onException >>>> >>>> Triggered whenever an XHR error arises. Has a custom signature: the >>>> first argument is the requester (i.e. an Ajax.Request instance), >>>> the >>>> second is the exception object. >>>> ----- >>>> >>>> What is confusing me about this description is "the first >>>> argument is >>>> the requester (i.e. an Ajax.Request instance), the second is the >>>> exception object." >>>> >>>> What is the proper syntax to see the first or second argument? >>>> Would >>>> it be something like... >>>> >>>> onException: function(a,b){alert(''first argument:''+a+'' second >>>> argument:''+b);} >>>> >>>> For me to handle the onException callback I need to know what it is >>>> sending back and how to reference the information it is sending so >>>> that I can formulate somse sort of response. >>>> >>>> Any help will be greatly appreciated >>>> >>>> >>>> Terry >>>> >>>> >>>> >>>> >>>> >>>> On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote: >>>> >>>> >>>> >>>>> Hello all, >>>>> >>>>> I have been developing some ajax stuff all week. Just this morning >>>>> the ajax calls quit working in Safari, and Firefox. I backed >>>>> out to >>>>> a last known working state and they still were not working, so I >>>>> added some handlers to see if I could sniff out the problem. >>>>> >>>>> ... >>>>> onException: function(transport){$ >>>>> ("serversaid").innerHTML=transport.toJSONString();}, >>>>> onFailure: function(){alert("12");}, >>>>> onLoading: function(){alert("13");}, >>>>> ... >>>>> >>>>> >>>>> The onException never triggered on Safari, but it did in Firefox. >>>>> The onLoading still triggers just fine. Here is the toJSONString >>>>> from the onException. >>>>> >>>>> {"transport":{},"options": >>>>> {"method":"get","asynchronous":true,"contentType":"application/x- >>>>> www-form-urlencoded","encoding":"UTF-8","parameters": >>>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username >>>>> ": >>>>> "r >>>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST" >>>>> :" >>>>> ht >>>>> mlos_login_username"}},"url":"http://clearimageonline.com/pages/ >>>>> htmlos/56272.1.238091707826617413? >>>>> submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&html >>>>> os >>>>> _l >>>>> ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username" >>>>> ," >>>>> me >>>>> thod":"get","parameters": >>>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username >>>>> ": >>>>> "r >>>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST" >>>>> :" >>>>> ht >>>>> mlos_login_username"}} >>>>> >>>>> I am not sure what this means or how to proceed. Is there >>>>> additional debugging techniques I could use. >>>>> >>>>> Thanks for any help, >>>>> >>>>> >>>>> Terry Riegel >>>>> >>>>> >>>>> >>>> >>>> >> >> >>> >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Jun-11 18:53 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
You are exactly correct with respect to anonymous functions. If they get arguments, you can name them whatever you want just like you and I did in our examples. Are you familiar with object oriented programming? If not, then I''d google up some info on that. That''s what let me know the basics of what I''d need to do with the objects that are passed to the onException callback. For the properties of the Ajax.Request object, you''re best bet is to (a) learn about the underlying XMLHttpRequest object (1) and then to look specifically at the Ajax options in prototype (2). The Error class is normal javascript (3) and, unless I''m missing something, isnt extended by prototype. Thus, you can find some good articles in it with google. Just search "javascript error object" and I got some good results. 1) http://tinyurl.com/233tq 2) http://prototypejs.org/api/ajax/options 3) http://tinyurl.com/hndna - Dash - Terry Riegel wrote:> David, > > Yes, that is very helpful. I appreciate you taking the time to > explain it to me. What is still confusing to me is the documentation. > Is this a deficiency in documentation (from the main prototype site). > Or is the deficiency in my understanding (I assume its the latter). > In other works where did you come to this knowledge you have? As I > read the documentation I don''t see that information. Can you suggest > some articles that would help bolster my understanding so that the > API to prototype would be more useful to me. > > I think the main thing you said that has helped me is this... > > If a callback has two arguments I can create an anonymous function > like... > > onException: function (param1,param2) { > // The callback arguments are param1, and param2 (they are most > likely objects) > // I could use json to string to see what the objects have in them > } > > Is this a correct understanding or am I missing the boat somewhere? > > Once again, thanks for taking the time to help me with this. I can > appreciate that it may be frustrating for you to have to baby step me > through this. > > > > Terry Riegel > > > > > > > On Jun 11, 2007, at 1:07 PM, David Dashifen Kees wrote: > > >> The arguments are objects, not really values. For example, the first >> argument is an instance of the Ajax.Request object that created the >> exception. Let''s assume that we named that argument "xhr" like this: >> >> onException: function(xhr, ex) { >> /* ... do something */ >> >> } >> >> Now, saying alert(xhr) will most likely say "Object" or something >> useless like that. But if we do something like this: >> >> alert(xhr.options.method); >> >> should result in either "get" or "post" (or "delete" or "push" if >> you''re >> using them) since we''re now accessing a specific property of the >> options >> object within the xhr object. >> >> The exception object, the second argument which I named "ex" above, is >> an object that can tell you information about the specific error that >> has occurred. The object has two properties named number and >> description, if I remember correctly. Therefore, like above, if you >> just alert(ex) you''ll get "Object" but if you alert(ex.description) >> the >> error message within the Error object should be alerted to the user. >> >> Does this help? >> >> - Dash - >> >> Terry Riegel wrote: >> >>> David, >>> >>> Thanks for your reply. What I still don''t get is the syntax to do >>> that. I want to see the first argument. How would I use alert(); to >>> see its value? >>> >>> Terry >>> >>> >>> >>> On Jun 11, 2007, at 9:45 AM, David Dashifen Kees wrote: >>> >>> >>> >>>> The first argument is the actual Ajax.Request object that originally >>>> generated the exception. That way you can get at information >>>> like the >>>> readyState, the url that it was trying to connect to, etc. The >>>> second >>>> argument is the exception object, which contains information like >>>> the >>>> error message that was generated by the browser, the error codes, >>>> etc. >>>> Each argument can help you in different ways. Perhaps, you could >>>> try >>>> the request again to see if it fails a second time, and for this, >>>> you''d >>>> need to access properties and methods of the first argument. >>>> But, if >>>> you wanted to display an error message to the visitor of your >>>> site and >>>> ask them to try and fix the problem (if possible) then you''re >>>> going to >>>> want to access methods and properties of the second argument. >>>> >>>> Does that help? >>>> >>>> - Dash - >>>> >>>> Terry Riegel wrote: >>>> >>>> >>>>> Hello, >>>>> >>>>> Maybe I need to simplify my question, or ask a related question >>>>> that >>>>> might help me come to a solution on my original question. >>>>> >>>>> From the prototype API instructions I read one of the common >>>>> callbacks to the ajax functionality is... >>>>> >>>>> ----- >>>>> onException >>>>> >>>>> Triggered whenever an XHR error arises. Has a custom signature: the >>>>> first argument is the requester (i.e. an Ajax.Request instance), >>>>> the >>>>> second is the exception object. >>>>> ----- >>>>> >>>>> What is confusing me about this description is "the first >>>>> argument is >>>>> the requester (i.e. an Ajax.Request instance), the second is the >>>>> exception object." >>>>> >>>>> What is the proper syntax to see the first or second argument? >>>>> Would >>>>> it be something like... >>>>> >>>>> onException: function(a,b){alert(''first argument:''+a+'' second >>>>> argument:''+b);} >>>>> >>>>> For me to handle the onException callback I need to know what it is >>>>> sending back and how to reference the information it is sending so >>>>> that I can formulate somse sort of response. >>>>> >>>>> Any help will be greatly appreciated >>>>> >>>>> >>>>> Terry >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Jun 9, 2007, at 9:18 AM, Terry Riegel wrote: >>>>> >>>>> >>>>> >>>>> >>>>>> Hello all, >>>>>> >>>>>> I have been developing some ajax stuff all week. Just this morning >>>>>> the ajax calls quit working in Safari, and Firefox. I backed >>>>>> out to >>>>>> a last known working state and they still were not working, so I >>>>>> added some handlers to see if I could sniff out the problem. >>>>>> >>>>>> ... >>>>>> onException: function(transport){$ >>>>>> ("serversaid").innerHTML=transport.toJSONString();}, >>>>>> onFailure: function(){alert("12");}, >>>>>> onLoading: function(){alert("13");}, >>>>>> ... >>>>>> >>>>>> >>>>>> The onException never triggered on Safari, but it did in Firefox. >>>>>> The onLoading still triggers just fine. Here is the toJSONString >>>>>> from the onException. >>>>>> >>>>>> {"transport":{},"options": >>>>>> {"method":"get","asynchronous":true,"contentType":"application/x- >>>>>> www-form-urlencoded","encoding":"UTF-8","parameters": >>>>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username >>>>>> ": >>>>>> "r >>>>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST" >>>>>> :" >>>>>> ht >>>>>> mlos_login_username"}},"url":"http://clearimageonline.com/pages/ >>>>>> htmlos/56272.1.238091707826617413? >>>>>> submitlogin=TRUE&ajaxrequest=FALSE&htmlos_login_username=root&html >>>>>> os >>>>>> _l >>>>>> ogin_password=&desktoplogin=&AESTIVACVNLIST=htmlos_login_username" >>>>>> ," >>>>>> me >>>>>> thod":"get","parameters": >>>>>> {"submitlogin":"TRUE","ajaxrequest":"FALSE","htmlos_login_username >>>>>> ": >>>>>> "r >>>>>> oot","htmlos_login_password":"","desktoplogin":"","AESTIVACVNLIST" >>>>>> :" >>>>>> ht >>>>>> mlos_login_username"}} >>>>>> >>>>>> I am not sure what this means or how to proceed. Is there >>>>>> additional debugging techniques I could use. >>>>>> >>>>>> Thanks for any help, >>>>>> >>>>>> >>>>>> Terry Riegel >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>> >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
tobie
2007-Jun-11 23:45 UTC
Re: AJAX Exception just started with Safari and Firefox on OS X, no problem on other machines
Terry, It looks from your initial code that you are using json.js, this is most certainly the reasons you are having problems. json.js is NOT compatible with Prototype because it extends Object.prototype. You should use Prototype''s built in JSON methods: You need to use at least Prototype 1.5.1 to do so. You''ll find a tutorial on them here: http://prototypejs.org/learn/json And I wrote a short blog post on migrating to using Prototype''s built in JSON support here: http://tobielangel.com/2007/3/15/migrating-to-prototype-s-native-json Hope this helps, Tobie --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---