与qTip动态内容的动态参数动态、参数、内容、qTip

2023-09-10 16:16:50 作者:一直想去有你的未来

我想通过与qTip动态参数,但它失败。 my_ajax_controller.php只显示变量的类型,但非q。

I want to pass a dynamic parameter with qTip, but it fails. my_ajax_controller.php just displays the variable type, but not 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作品的静态值:

However, a static value of q works:

$('a.menu_help').qtip({
    content: {
      url:'my_ajax_controller.php',
      data: 'type=help_menu&q=toto',
      method: 'get'
    },
    show: 'mouseover',
    hide: 'mouseout'
});

请问有没有办法通过一个动态值的参数数据?

Is there no way to pass a dynamic value to the parameter data ?

在此先感谢!

弗洛朗

推荐答案

它应该工作,但只是尝试,看看你传递的ID,或者传递数据的收集是这样的:

It should work, but just try to see what you pass as ID, or pass data as collection something like:


data : {'type':'help_menu', 'q':id}

   
 $('a.menu_help').qtip({
    var id = $(this).attr('id');
    alert(id);
    content: {
      url:'my_ajax_controller.php',
      data: 'type=help_menu&q='+ id,
      method: 'get'
    },
    show: 'mouseover',
    hide: 'mouseout'
});