2010-02-19 8 views
4

qTip으로 동적 매개 변수를 전달하려고하지만 실패합니다. my_ajax_controller.php는 변수 유형을 표시하지만 q는 표시하지 않습니다. 그러나qTip으로 동적 내용의 동적 매개 변수

$('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' 
}); 

없는가

미리 감사드립니다. 이 같은

플로랑

답변

-7

그것은 작동하지만 당신이 ID로 전달할 무엇을 참조하거나 같이 수집 무언가로 데이터를 전달하려고한다 : 나는이 같은 문제를했고 내가 해결

 
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' 
}); 
+0

이것은 작동하지 않습니다. –

+0

이 작업을 수행 할 수 없다는 것을 확인했습니다. 개체 정의 내에서 할당을 수행하고 있습니다. 당신은'missing : after 속성 id'를 얻을 것입니다. –

8

시도 뭔가 :

$('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' 
}); 

나는이 테스트를하지 않은,하지만 난 비슷한 일을했습니다. 지금 당장은 그것을 찾을 수 없습니다.

+0

이 솔루션은 잘 작동합니다. – Jeremy

+0

많은 qtipped 요소로 여전히 성능이 좋습니까? –

+0

성능을 다르게 변경해서는 안됩니다. – Patricia

3

이 코드와 함께. qtip 1.0 rc3 및 JQuery 1.4.2에서 잘 작동합니다. qtip에 jquery> 1.3이 있고 문제가 있음에 유의하십시오. 관련 정보는 Google에 문의하십시오. 그러나 jquery.qtip.js에서 한 줄을 추가하면 고칠 수 있습니다.

$('.username_link').each(function(){ 
    $(this).click(function(){ return false });//JS enabled => link default behavior disabled. Gaceful degradation 
    $(this).qtip({ 
    content: { url: '/users/links', 
       data: { id: $(this).attr('data-id') }, 
       method: 'post' 
      }, 
    show: 'click', 
    hide: 'mouseout' 
    }) 
});