我想用qTip传递一个动态参数,但是失败了。 my_ajax_controller.php 仅显示变量类型,但不显示 q。
$('a.menu_help').qtip({
content: {
url:'my_ajax_controller.php',
data: 'type=help_menu&q='+$(this).attr('id'),
method: 'get'
},
show: 'mouseover',
hide: 'mouseout'
});
但是,q 的静态值有效:
$('a.menu_help').qtip({
content: {
url:'my_ajax_controller.php',
data: 'type=help_menu&q=toto',
method: 'get'
},
show: 'mouseover',
hide: 'mouseout'
});
有没有办法将动态值传递给参数数据?
提前致谢!
弗洛伦特
最佳答案
尝试这样的事情:
$('a.menu_help').each(function(){
$currentLink = $(this);
$currentLink.qtip({
content: {
url:'my_ajax_controller.php',
data: 'type=help_menu&q='+$currentLink.attr('id'),
method: 'get'
},
show: 'mouseover',
hide: 'mouseout'
});
我还没有测试过这个,但我做过类似的事情。只是现在找不到。
关于jquery - 使用 qTip 的动态内容的动态参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2297869/