How to AJAX-ify something that is not <a>?

Notice: This thread is very old.
karelb
Member | 17
+
0
-

Hello,

simple newbie question,

I like how simple is to “ajaxify” <a href>s with <a n:href="signal!" class="ajax">; however, now I want to add on-click action for something that is not <a>. How do I do that easily?

For example, I want to add something like this to a <td> element. <td n:href="signal!" class=ajax> does not work. Enclosing the <td> with <a> does not work either.

What is the simpliest way to achieve this?

Last edited by karelb (2013-12-26 18:45)

Aurielle
Member | 1281
+
0
-

I don't think you can attach href parameter to <td>. In this case you'd have to write your own JS code.

petr.pavel
Member | 535
+
0
-
<td data-href="{plink signal!}" class="ajax">
$('td.ajax').on('click', function() {
  var url = $(this).data('href');
  // etc.
});