17th March, 00:09
I noticed that when I created a qTip with a content URL, that the AJAX call happened immediately. Not good for what I had in mind (user info tooltips on a forum, so it made lots of AJAX calls right as the page loaded), but I found a way (based on a suggestion from Craig) to make it only happen when the tooltip is actually shown the first time.
Put the URL you wish to load (or some piece of information you will use to generate the URL) in the ALT attribute of the link that will create the tooltip. I tried using a custom attribute, but IE7 choked on it, so I used ALT since it won't affect the behavior of an anchor tag; however, you could use a different attribute (like title).
Use this in the options when you call .qtip()
Put the URL you wish to load (or some piece of information you will use to generate the URL) in the ALT attribute of the link that will create the tooltip. I tried using a custom attribute, but IE7 choked on it, so I used ALT since it won't affect the behavior of an anchor tag; however, you could use a different attribute (like title).
Use this in the options when you call .qtip()
JS Code
content: {
text: 'Loading...'
},
api: {
beforeShow: function() {
var url = this.elements.target.attr('alt');
if (url != '') {
this.loadContent(url);
}
},
onContentLoad: function() {
this.elements.target.attr('alt', '');
}
}