SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    clipbucket javascript

    Hello, in the channel of a user in clipbucket, down page there are the tabs "Activity", "Infos", "Videos", "Groups" and "Photos"...
    When I click in Videos, Groups and Photos tabs clipbucket doesn't load and show them, could you help me solve this?
    the only problem sometimes I get in javascript error consol is "The object doesn't support the method appendTo". I marked red the line with the problem in the code below here.
    you can see the problem in this page, logging in with "arvixe" as username and password

    <snip>

    Thank you

    Code:
    function channelObjects(object,div,type,user,assign)
    {
    	var obj = $(object), curRel = obj.attr('rel'),
    		DIV = $(div), oldRel = obj.parents('ul').find('a.selected').attr('rel');
    	
    	if(curRel)
    	{
    		if($("#"+curRel).css('display') == 'block')
    			return false;
    		else
    		{
    			obj.parents('ul').find('a.selected').removeClass('selected');
    			obj.addClass('selected');
    			
    			$("#"+oldRel).hide();
    			$("#"+curRel).show();		
    		}
    	} else {
    		var newRel = type+"DIV";
    		obj.attr('rel',newRel);
    		$.ajax({
    		 url : page,
    		 type : "POST",
    		 dataType : "json",
    		 data : ({ mode : "channelObjects", content : type, user : user, assign : assign}),
    		 beforeSend : function() { obj.append(loading_img) },
    		 success : function(data)
    		 {
    			obj.find('img').remove();
    			obj.parents('ul').find('a.selected').removeClass('selected');
    			obj.addClass('selected');		
    		
    			$("#"+oldRel).hide();
    			$("<div></div>").attr('id',newRel).addClass($("#"+oldRel).attr('class')).html(data.html).appendTo(DIV); 
    		 }
    		})	
    	}
    Last edited by ralph.m; Dec 17, 2011 at 02:12. Reason: link removed

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The problem is that jQuery's html() method returns a string, not a jQuery object.

    I think all you need to do is move the "appendTo" earlier in the chain, so that it's before the "html" method.

    Of course, there might be more going on; that's just the first thing that jumped out at me.

    Off Topic:


    Are we allowed to link to porn?
    I'm the web overlord for Graphic Business Systems

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,319
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Off Topic:

    No, porn links are not allowed. Hopefully the question can be answered without the link. Otherwise, in future, put up a test page demonstrating the code but without the porn on a test domain etc.

  4. #4
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked on the official clipbucket site and the function is exactly like mine so the problem isn't there and i don't know why it doesn't show them...
    it call elements that are in the mysql database so i guess there is some php code associated with js doing that but where is?

    thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •