Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to disable qTip upon AJAX failure?
10th November, 10:51
Post: #1
How to disable qTip upon AJAX failure?
I have the following code but it doesn't seem to work properly.

JS Code
$(this).qtip({
	overwrite: false,
	content: {
		text: 'Loading...',
		title: 'Who liked this',
		ajax: {
			loading: false,
			url: '/api_proxy/comments/'+cid+'/likes/',
			type: 'GET',
			dataType: 'json',
			error: function() {
				this.hide();
				this.disable(true);
			},
			statusCode: {
				204: function() {
					this.hide();
					this.disable(true);
				}
			},
			success: function(json_reply, status) {
				var linked_usernames = new Array();
				for (var i=0; i<json_reply.length; i++) {
					var avatarURL = json_reply[i].avatar_img.replace('/m/', '/m/xs/');
					var link = '<div><a href="'+json_reply[i].url+'"><img src="'+avatarURL+'" style="max-width: 12px; max-height: 12px;" /> <span>'+json_reply[i].username+'</span></a></div>';
					linked_usernames.push(link);
				}
				this.set('content.text', linked_usernames.join(''));
			}
		}
	},
	..... the rest of settings .....
Find all posts by this user
Quote this message in a reply
10th November, 11:05
Post: #2
RE: How to disable qTip upon AJAX failure?
What do you mean by "not work properly"?

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
10th November, 12:13 (This post was last modified: 10th November 12:25 by catherinek.)
Post: #3
RE: How to disable qTip upon AJAX failure?
The code above should disable the tooltip if there's no results to be shown (statusCode: 204).
However, the following happens when seen in the browser:
first mouseover, no tooltip shown
mouseout then mouseover again, a tooltip like below is displayed.
[Image: UpnqS.png]
Find all posts by this user
Quote this message in a reply
10th November, 18:47
Post: #4
RE: How to disable qTip upon AJAX failure?
Can you setup a test case for this please? http://jsfiddle.net/fDavN/

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
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Dynamically disable/enable tips on the same trigger without refreshing page dvieira 1 702 27th October 18:01
Last Post: Craig



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