Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the data from database through tooltip?

i want to display the data from ajax request to tooltip, it's open in modal window right now, but I want to open it into the tooltip, how can I do that, I tried a lot but didn't get success, I stucked at here, please help me to show data through tooltip.

this is my view code

  echo $this->Manager->link('Groups',array('action'=> 'test_contact_group', $records['Contact']['contact_id']),array('class'=>'ajax_links'));

the html of this link is

   <a class="ajax_links" help="a" href="/contacts/test_contact_group/78">Groups</a>

and jquery is there

     <script>
$(".ajax_links").hover(function(e) {

    e.preventDefault(); 
    var link = $(this).attr('href');

    $.ajax({ 
        type: "POST",   
        url: link,
        cache: false
    }).done(function( html ) { 

        jQuery('#myModal').modal('show');
        jQuery('.modal-body').html("Groups" + html);

    });
});


</script>

it is diplay in modal window, but I want to open it in tooltip, how can I do that, please help me. thanks a ton in advance, I really stucked here.

like image 424
user2046638 Avatar asked Mar 08 '13 12:03

user2046638


1 Answers

Hope this will help you..

$(".ajax_links").hover(function(e) {

    e.preventDefault(); 
    var link = $(this).attr('href');

    $.ajax({ 
        type: "GET",   
        url: link,
        success : function (data){
        $('#elementId').attr('title',data);
        } 

    });
});
like image 91
Anand G Avatar answered Oct 08 '22 07:10

Anand G