[Proto-Scripty] Ajax functions not working inside classes.

2009-12-06 Thread evilC
The following code works: new Ajax.Request('somefile.php',{ method:'get', onSuccess: function(transport){ var response = transport.responseText || "no response text"; alert("Success! \n\n" + response); }, onFailure: function(){

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread T.J. Crowder
Hi, > is prototype broken? No, I use Ajax functions within classes all the time. > however, if you encapsulate the code inside a class: > > var myclass = Class.create({ > > > }); If I "cut and paste exact same code into here" I get this: > var myclass = Class.create({ > new Ajax.Reque

[Proto-Scripty] Re: document.write() vs Element/appendChild()

2009-12-06 Thread fma
So, does anybody understand why the full new-style element creation does not work well under IE? -- 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-scriptacul...@googlegroups.com. To uns

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread evilC
Thanks TJ, I tried to make a self-contained version, so I ripped out prototype and did the same thing with object literals, and I still had issues, so clearly it wasnt prototype. In the end I figured out that the button which fired off the AJAX request (ie the "Submit" button) was inside a form (I

Re: [Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread Rick Waldron
Instead of onSuccess, try using onComplete... -- Sent from my Palm Prē evilC wrote: Thanks TJ, I tried to make a self-contained version, so I ripped out prototype and did the same thing with object literals, and I still had issues, so clearly it wasnt prototype. In the end I figured out that t

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread evilC
I have put up a version on my web server. http://www.evilc.com/pb The JS file is at http://www.evilc.com/pb/placebook.js - the code you are interested in will be in the pb_editloc object near the end. The HTML of the form is at http://www.evilc.com/pb/templates/pb_add_location.html (the php grab

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread evilC
Just tried onComplete - no joy I uploaded a copy to http://www.evilc.com/pb/pb.zip, should anyone be so kind as to be inclined to take a look at it. If you have a localhost LAMP server (I use XAMPP) with default sql account of root/ , it will work without any modifications - just create a databas

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread T.J. Crowder
Hi, > Once the AJAX reply comes back that the data was updated, I want to > destroy the form. But it won't let me. I guess for a similar reason to > my explanation above - the button started the call, and it is in the > response code that I wish to destroy it, so it technically hasn't > finished y

[Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread T.J. Crowder
Hi, > Just tried onComplete - no joy You probably don't want onComplete. onComplete is called regardless of whether the request was successful. You probably want onSuccess and onFailure, doing different things. -- T.J. On Dec 6, 7:25 pm, evilC wrote: > Just tried onComplete - no joy > > I uplo

Re: [Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread Rick Waldron
The problem is that when the dom is loaded... there is no such thing as "pb_add_location". On Sun, Dec 6, 2009 at 5:09 PM, T.J. Crowder wrote: > Hi, > > > Just tried onComplete - no joy > > You probably don't want onComplete. onComplete is called regardless of > whether the request was succ

Re: [Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread Rick Waldron
Actually, my reasoning for that response was a fluke, so ignore it the problem: you're calling "*this*.deleteform()" I noticed you use all kinds of alert()'s for debugging... i'd recommend learning firebug and making it your very best friend. Firebug told me that " *this*" IS NOT *pb_editloc*, i

Re: [Proto-Scripty] Re: Ajax functions not working inside classes.

2009-12-06 Thread Rick Waldron
Also, in PHP related advice, *ereg *and *split* are deprecated. if you turned on your PHP errors and use E_ALL, it will throw back errors. Rick On Sun, Dec 6, 2009 at 6:36 PM, Rick Waldron wrote: > Actually, my reasoning for that response was a fluke, so ignore it > > > the problem: you're cal