2007/11/4, Jorge Laranjo <[EMAIL PROTECTED]>:

> <a href="link to my action" onclick="link to ajax action">link</a> ?
>
> The href="" is the part that give us the accessible way even if the browser
> doesn't know javascript.

A nice way to handle this is to make normal link and manage them with
javascript for Ajax request thre normal way. Imagine a link and a div
you want to fill with the result of a click on the link:

<a href="/my/action" class="ajax-link">Click me</a>
<div id="ajax-result" style="display:none"></div>

With a library like jQuery you can easily do something like:

$('a.ajax-link').click(function(){
  $.get($(this).attr(href), function(response){
    $('#ajax-result').html(response).show();
  });
  return false;
});

Then you have to deal with your action which'll have to be decorated
or not if used the standard http wey or the ajax one. You're luck,
Symfony does this job for you automagically, so the response of your
action won't be decorated if your in an xmlHttpRequest context :)

You can also have a look at the sfUJSPlugin which does quite the same
thing descibed as above.

++

-- 
Nicolas Perriault    http://www.clever-age.com
Clever Age - conseil en architecture technique
GSM: +33 6 60 92 08 67  Tél: +33 1 53 34 66 10

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to