[Proto-Scripty] Re: Ajax.Request & unload

2009-01-08 Thread joe t.

DAMMIT!
i found the bugger. It was a similar piece of PHP in a different file
that gets called when the page LOADS!
Everything was getting cleaned up before the piece i'm examining could
ever happen.

By the way, Firebug WAS reporting the FirePHP logs. It just happens
that it was displaying them when the next page loaded. Kinda weird,
easy to miss.

Anyway, thanks to both of you for your help.
-joe t.


On Jan 8, 10:41 am, "joe t."  wrote:
> i presume the page hasn't already unloaded, because the document is
> still visible, Firebug can still break at my designated markers, the
> "alert('Wait!')" line still executes AFTER the Ajax call, and only
> after i clear the alert does the page actually clear. Being that i'm
> setting {asynchronous:false}, i believe that alert won't execute until
> the Ajax is complete.
>
> If i place this particular block in "beforeunload", i have no way to
> tell the PHP if the user has elected to continue unloading or has
> canceled the unload. The PHP in this case cleans up files the user has
> uploaded while on this page. Since i can't utilize the "beforeunload"
> confirm's return value, the user's files would get cleaned up even if
> they cancel the unload.
> -joe t.
>
> On Jan 8, 9:47 am, Walter Lee Davis  wrote:
>
>
>
> > Perhaps the unload event has already happened and the page is "gone"?  
> > What happens if you change this event to beforeunload?
>
> > Walter
>
> > On Jan 8, 2009, at 9:41 AM, joe t. wrote:
>
> > >>> Event.observe(window,'unload',function(){
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Request & unload

2009-01-08 Thread joe t.

i presume the page hasn't already unloaded, because the document is
still visible, Firebug can still break at my designated markers, the
"alert('Wait!')" line still executes AFTER the Ajax call, and only
after i clear the alert does the page actually clear. Being that i'm
setting {asynchronous:false}, i believe that alert won't execute until
the Ajax is complete.

If i place this particular block in "beforeunload", i have no way to
tell the PHP if the user has elected to continue unloading or has
canceled the unload. The PHP in this case cleans up files the user has
uploaded while on this page. Since i can't utilize the "beforeunload"
confirm's return value, the user's files would get cleaned up even if
they cancel the unload.
-joe t.


On Jan 8, 9:47 am, Walter Lee Davis  wrote:
> Perhaps the unload event has already happened and the page is "gone"?  
> What happens if you change this event to beforeunload?
>
> Walter
>
> On Jan 8, 2009, at 9:41 AM, joe t. wrote:
>
>
>
> >>> Event.observe(window,'unload',function(){
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Request & unload

2009-01-08 Thread Walter Lee Davis

Perhaps the unload event has already happened and the page is "gone"?  
What happens if you change this event to beforeunload?

Walter

On Jan 8, 2009, at 9:41 AM, joe t. wrote:

>>> Event.observe(window,'unload',function(){
>>


--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Request & unload

2009-01-08 Thread joe t.

Thanks for responding, and checking the code.

i guess i should have noted: i'm also using FirePHP, so there are
lines in place sending debug log lines back to Firebug. However, on
only this particular call, absolutely nothing gets sent back from the
server. Not even a log line saying the PHP script was executed.

No SOP violation (Internal.fileList.Path is correct), i've adjusted
all Internal references to be prefixed by window, though you are
correct, there are no other "Internal" objects in that context.

In a bizarre twist, if i create a new button in my application and
observe "click" to the EXACT same block of code, it executes
flawlessly.
-joe t.


On Jan 8, 5:27 am, "T.J. Crowder"  wrote:
> Hi Joe,
>
> The client-side code looks okay to this second pair of eyes.  (You
> might want to put "window." in front of "Internal" in the Ajax.Request
> constructor, just for consistency as you've done it everywhere else.
> But I'm assuming you don't have some other "Internal" defined in
> scope, and so it should be using the same one anyway.)
>
> I'd suggest the usual things:  Check that
> window.Internal.fileList.Path really has the correct path and that
> it's not violating SOP; temporarily try replacing that path with a
> static file path to eliminate issues in the server-side processing;
> put debugging checks on the server-side resource it's calling; the
> usual sort of stuff.  I suspect an issue with the server-side
> resource.
>
> But the client-side part looks okay, FWIW.
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Jan 7, 6:59 pm, "joe t."  wrote:
>
>
>
> > i have the following:
> > Event.observe(window,'unload',function(){
> >   if (window.Internal && window.Internal.doUnload){
> >     (new Ajax.Request(Internal.fileList.Path,{
> >       asynchronous:false,
> >       method:"get",
> >       parameters:{"do":"unload",task:$_GET.p},
> >       onSuccess:function(t){alert('Success: ' + t.responseText);}
> >     }));
> >     alert('Wait!');
> >   }
>
> > });
>
> > The "Wait" alert at the end is just for testing. It does fire.
>
> > The problem is, the Ajax call does not seem to work at all. Firebug
> > tells me the Ajax block is executed, the onSuccess alert even fires.
> > But t.responseText is always empty, and the actions i've defined in my
> > server-side code are not happening.
>
> > Any takers to try helping me track this down?
> > -joe t.
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Request & unload

2009-01-08 Thread T.J. Crowder

Hi Joe,

The client-side code looks okay to this second pair of eyes.  (You
might want to put "window." in front of "Internal" in the Ajax.Request
constructor, just for consistency as you've done it everywhere else.
But I'm assuming you don't have some other "Internal" defined in
scope, and so it should be using the same one anyway.)

I'd suggest the usual things:  Check that
window.Internal.fileList.Path really has the correct path and that
it's not violating SOP; temporarily try replacing that path with a
static file path to eliminate issues in the server-side processing;
put debugging checks on the server-side resource it's calling; the
usual sort of stuff.  I suspect an issue with the server-side
resource.

But the client-side part looks okay, FWIW.
--
T.J. Crowder
tj / crowder software / com

On Jan 7, 6:59 pm, "joe t."  wrote:
> i have the following:
> Event.observe(window,'unload',function(){
>   if (window.Internal && window.Internal.doUnload){
>     (new Ajax.Request(Internal.fileList.Path,{
>       asynchronous:false,
>       method:"get",
>       parameters:{"do":"unload",task:$_GET.p},
>       onSuccess:function(t){alert('Success: ' + t.responseText);}
>     }));
>     alert('Wait!');
>   }
>
> });
>
> The "Wait" alert at the end is just for testing. It does fire.
>
> The problem is, the Ajax call does not seem to work at all. Firebug
> tells me the Ajax block is executed, the onSuccess alert even fires.
> But t.responseText is always empty, and the actions i've defined in my
> server-side code are not happening.
>
> Any takers to try helping me track this down?
> -joe t.
--~--~-~--~~~---~--~~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---