Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to use variable in Ajax tooltip?

I have some HTML like this:

<span class="ajaxtip" data-term="frog">Frog</span>

How can I get the contents of data-term in to the post data of the ajax request?

Tipped.create(                                                                                                                                               
  '.ajaxtip',                                                                                                                                                                                                                                                                                                 
  {                                                                                                                                                            
    ajax: {                                                                                                                                                    
      url: 'ajax.php',                                                                                                                              
      type: 'post',                                                                                                                                            
      data: { term: **put "frog" here** }                                                                                                                                
    }                                                                                                                                                          
  }                                                                                                                                                            
);

Comments

Sign In or Register to comment.