如何通过工具提示显示数据库中的数据?

时间:2021-03-02 19:29:41

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.

我想显示从ajax请求到工具提示的数据,它现在在模态窗口中打开,但是我想把它打开到工具提示中,我怎么能这样做,我尝试了很多但没有成功,我坚持在这里,请帮我通过工具提示显示数据。

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

这个链接的HTML是

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

and jquery is there

和jquery在那里

     <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.

它是在模态窗口中显示,但我想在工具提示中打开它,我该怎么做,请帮助我。非常感谢,我真的很喜欢这里。

3 个解决方案

#1


1  

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);
        } 

    });
});

#2


0  

If the issue is only with jquery syntax, you can try this:

如果问题仅与jquery语法有关,您可以尝试这样做:

   $(this).attr("title", html);

#3


0  

Instead of modal window. you just have a container for div with id tooltip. like this. then append the results. some thing like this : demo tooltip. and CSS taken from this answer Pure CSS Tooltip

而不是模态窗口。你只有一个带有id工具提示的div容器。喜欢这个。然后追加结果。像这样的东西:demo tooltip。和CSS取自这个答案Pure CSS Tooltip

$('#toolTip').show();

Working demo : DEMO for Tooltip

工作演示:DAPO for Tooltip

or you can append to title attribute.

或者你可以附加到title属性。

 $('#elementId').attr('title',data);

#1


1  

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);
        } 

    });
});

#2


0  

If the issue is only with jquery syntax, you can try this:

如果问题仅与jquery语法有关,您可以尝试这样做:

   $(this).attr("title", html);

#3


0  

Instead of modal window. you just have a container for div with id tooltip. like this. then append the results. some thing like this : demo tooltip. and CSS taken from this answer Pure CSS Tooltip

而不是模态窗口。你只有一个带有id工具提示的div容器。喜欢这个。然后追加结果。像这样的东西:demo tooltip。和CSS取自这个答案Pure CSS Tooltip

$('#toolTip').show();

Working demo : DEMO for Tooltip

工作演示:DAPO for Tooltip

or you can append to title attribute.

或者你可以附加到title属性。

 $('#elementId').attr('title',data);