Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Using dynamically loaded content as well as DOM content; 'this' troubles
2nd April, 04:40
Post: #1
[Solved] Using dynamically loaded content as well as DOM content; 'this' troubles
I'm trying to create qtips which uses some dynamically loaded content along with some other content found elsewhere in the document. I've scoured the forum, and learned how to do each of those things separately, but can't figure out how to do both together. The problem is with 'this'.

Here's the outline I've got so far;

JS Code
$jq(this).each(function() {
  n = this;
  $jq(this).qtip({
    content: 'old content',
    api: {
      onRender: function() {
        var attrvar = $jq(n).attr('myattr');
        $jq.get('someurl',function(resp) {
          $jq(this.elements.content).html(resp);
        });
      }
    },
  });
});


The problem is with the AJAX callback; how can I get it the proper context so it can update the qtip content model?

Thanks.
Find all posts by this user
Quote this message in a reply
2nd April, 14:11
Post: #2
RE: Using dynamically loaded content as well as DOM content; 'this' troubles
Store the context in a separate variable Smile

JS Code
onRender: function() {
        var attrvar = $jq(n).attr('myattr'), api = this;
        $jq.get('someurl',function(resp) {
          $jq(api.elements.content).html(resp);
        });
      }

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
  Recover title attribute content on hide baps 2 19 Yesterday 23:38
Last Post: baps
  [Solved] Hover text and AJAX content gottihh 2 96 10th May 07:24
Last Post: gottihh
  [Solved] Dynamic Content From Page Element frogg3862 2 91 3rd May 17:12
Last Post: frogg3862
  [Solved] Multiple qtips on one page, content disappearing russau 3 123 3rd May 16:38
Last Post: Craig
  [Solved] qtip showing content from db doesn't change when content in db changes. vtoepel 2 145 23rd April 16:02
Last Post: vtoepel
  [Solved] Tipp with title & content in title fspade 2 363 21st February 06:42
Last Post: fspade
  [Solved] QTip content from existing div element on page? dcash 4 2,527 8th December 18:29
Last Post: Craig
  Change the content niek 5 468 27th November 15:01
Last Post: Craig
  Changing HTML Content on Click & Remove/Reinit qTips ifthatdoesntdoit 5 1,228 17th November 09:46
Last Post: ifthatdoesntdoit
  [Solved] Is there an easier way to show/hide tooltips dynamically? gloosemo 1 683 17th October 15:58
Last Post: Craig



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