if I understand what you are going for, there's no need for custom
events:

$('ph').observe('click', function(event) {
                event.preventDefault();
                new Ajax.Request(url, {
                        ..... process request
                });
        });

Also, you can't use DOM events for custom events.

$('ph').observe('click', function(event

On May 15, 1:54 am, marioosh <[email protected]> wrote:
> I have <a id="ph" href="#">.
> I want to do that (sorry for my poor english):
> When user click ph, i need to set href to some usable address (by
> sending request Ajax.Request) and fire onclick once again.
>
> I've done like below, but not works good :/ Please help... how to do
> this better ?
>
>                         $('ph').observe('click', function() {
>                                 Event.stop(event);
>                                 $('ph').fire('owner:click');
>                         });
>
>                         $('ph').observe('owner:click', function() {
>
>                                 if($('ph').href.endsWith('#')) {
>
>                                         new Ajax.Request("geturl.php", {
>                                                 onComplete: function(request) 
> {
>                                                         $('ph').href = 
> request.responseText;
>                                                         
> $('ph').fire('owner:click');
>                                                 }.bind(this)
>                                         });
>                                 } else {
>                                                     // open link...
>                                                 }
>
>                         });
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to