Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
api.hide() after an ajax request
29th April, 12:02 (This post was last modified: 29th April 12:10 by kritro.)
Post: #1
api.hide() after an ajax request
Hi Craig (and others)

My message is in relation with this previous problem which is not solved :
http://craigsworks.com/projects/qtip/for...e-problem/

I noticed this :

- You have a tooltip displayed.
- You hide it, it works,
- you do an ajax request (with $.ajax),

and on success function, you have this :

JS Code
success: function(msg) {
api.hide();}


Here is the point : the tool tip shows during a second or less and hides !

Furthermore, if you dont do api.hide() on success function, the tooltip shows !



Is it normal?

What do you think Craig ?

This is the same problem I noticed with my previous topic related.
Thanks
Find all posts by this user
Quote this message in a reply
29th April, 13:27
Post: #2
api.hide() after an ajax request
Hi gostbuster,

I'm not sure why this is happening... unless the ajax method itself causes the tooltip to show. How are you updating the content? Could I see your code please?

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
29th April, 13:47
Post: #3
api.hide() after an ajax request
Of course, you have my previous problem in the link related at the top of the topic, and now, here is my code :
JS Code
//the div 'deplacer'(=move) is a part of the tooltip content
$("#deplacer").live("click",function(){
 
 
         var num=$(this).attr("num");//i get the num value
 
 
           var input = $("#numero"+num); 
            var api = input.qtip('api'); //get the api
            api.hide();//api hides no problem, I wanna hide it because i'm gonna drag!
 
      input.draggable({ //a set my input draggable with jquery ui
           containment: 'parent',//interdire de sortir de la carte
 
            //action au drop   -->action on drop (you know, drag'n'drop...)
             stop: function(event, ui) {
 
           $(this).draggable( 'disable' ); //disable the draggable effect
 
 
 
            $.ajax({ //this is my ajax request
               type: "POST",
               url: '/emplacements/modifierposition/numero/'+num+'/posx/'+posix+'/posy/'+posiy, //it has some parameters but I simplified the code,
 
               success: function(msg) {
                  api.hide(); //here is the point : when i get the success of the ajax request, the tooltip display just one second and hide!
               },
 
            });
 
 
 
 
               }});
 
 
 
 
      });


Hope you'll understand it.
thanks
Find all posts by this user
Quote this message in a reply
29th April, 17:04
Post: #4
api.hide() after an ajax request
What show event are you using for your qTip? I have a feeling the click event is firing the show event of the tooltip.

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
29th April, 19:33
Post: #5
api.hide() after an ajax request
Hi Craig,

I'm not really sure to understand your question but I'll try to answer it :

For my input problem (test the value with an ajax request and display a tooltip if the value is not correct), I use the blur effect.

For this problem here is the scenario :

I click e (will be my element),
A tooltip displays, I click on a item in the tooltip which activates the drag.
I hide the tooltip,

JS Code
var input = $("#numero"+num); 
            var api = input.qtip('api'); //get the api
            api.hide();//api hides no problem, I wanna hide it because i'm gonna drag!


I can now drag e
when I drop e ,I trigger this :

JS Code
//action au drop   -->action on drop (you know, drag'n'drop...)
             stop: function(event, ui) {
 
           $(this).draggable( 'disable' ); //disable the draggable effect
 
 
 
            $.ajax({ //this is my ajax request
               type: "POST",
               url: '/emplacements/modifierposition/numero/'+num+'/posx/'+posix+'/posy/'+posiy, //it has some parameters but I simplified the code,
 
               success: function(msg) {
                  api.hide(); //here is the point : when i get the success of the ajax request, the tooltip display just one second and hide!
               },
 
            }


The tooltip shows and hides in the next second. If I don't write api.hide() on succes, the tooltip shows (it was hidden...)

Hope i'll answer you with this.

Thanks
Find all posts by this user
Quote this message in a reply
1st May, 16:35
Post: #6
api.hide() after an ajax request
Hi Craig,

did you try this scenario :

hide a tooltip, do an ajax request, and hide it on the success of it ?

thanks
Find all posts by this user
Quote this message in a reply
1st May, 22:19
Post: #7
api.hide() after an ajax request
Hi gostbuster,

I've tried several different variations on his and I can't reproduce this bug... checkout my test code:
JS Code
<html>
<head>
</head>
<body>
<p><span class='qtip'><b>Click me</b> for a qtip</span></p>
<p>
<p><span class='ajax'><b>Click me</b> to make an ajax request</span></p>
 
 
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.qtip.js"></script>
<script type="text/javascript" src="jquery.qtip.debug.js"></script>
<script>
$(document).ready(function(){
   $('.qtip').qtip({
      content: {
         text: 'This is the qTip content.',
         title: {
               text: 'qTip Title'
         }
      },
      show: 'click',
      hide: 'click'
   });
 
   $('.ajax').click(function()
   {
      $.ajax(
      { 
         type: "GET",
         url: 'democontent.html', //it has some parameters but I simplified the code,
 
         success: function(msg) 
         {
             $('.qtip').qtip('api').hide(); //here is the point : when i get the success of the ajax request, the tooltip display just one second and hide!
         }
      });
   })
});
</script>
</body>
</html>

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
4th May, 08:06
Post: #8
api.hide() after an ajax request
Hi Craig, I just tested your code, and it works.

But I noticed something: The time during the qtip is displayed depends on the request ajax.

Exemple :

-If the request is simple : the qtip will show during less than 1 second.
-Otherwise the request is complicated (I tried this below) the qtip will show during more than 10 seconds...

May it be a clue ?

Thanks.

Here is what I tried to make the request complicated:

JS Code
for($i=0;i<10000;$i++)
          {
             echo "youhhh";
          }
Find all posts by this user
Quote this message in a reply
5th May, 15:36
Post: #9
api.hide() after an ajax request
Hi gosbuster,

Would you upgrade to the latest branch code revision and tell me if this bug is still occuring please?

http://bazaar.launchpad.net/~craig.craig...runk/files

Thanks in advance.

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
6th May, 07:32
Post: #10
api.hide() after an ajax request
Hi Craig,

I just tried the lastest release branch, and I'm afraid that the bug is still occuring......

The strangest is that you didn't succeed to reproduce the bug !
I'm working on local server, may it be the issue....
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Show on click, hide on unfocus ttomor 4 132 3rd May 14:39
Last Post: ttomor
  [Solved] Hovering over same tip location causes it to hide jaredf 1 270 22nd March 14:52
Last Post: Craig
  can't hide qtip in a “position: absolute;” div shdog 1 267 14th March 17:35
Last Post: Craig
  hide on unfocus in build 55 bradw2k 1 329 20th January 17:03
Last Post: Craig
  [Solved] ajax data request on hover settoloki 0 473 30th November 08:42
Last Post: settoloki
  [Solved] Is there an easier way to show/hide tooltips dynamically? gloosemo 1 665 17th October 15:58
Last Post: Craig
  [Solved] Hide tooltip when clicked dabd 10 1,186 23rd August 18:55
Last Post: dabd
  onLoad and then hide after 10 seconds mediaslave 3 1,990 16th June 17:02
Last Post: weber
  Show api function not working occulens 1 688 27th May 17:10
Last Post: Craig
  [Solved] Cannot access api Chris_Bones 2 562 26th January 15:52
Last Post: Chris_Bones



User(s) browsing this thread: 1 Guest(s)