SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    JS won't load after Ajax is called

    My javascript isn't loading after the ajax generated code is called.

    Jquery
    Code JavaScript:
    $(function() {
          $('div#lightBoxCloseButton').click(function() {
          	$('div.lightBoxCon').hide();
          });
    });

    Ajax Code
    Code HTML4Strict:
    if($ajax == true)
    	{
    		$q = mysql_query("SELECT users.`id`, users.`firstname`, .users.`lastname` FROM users WHERE users.`username`='${u}'");
    		$r = mysql_fetch_assoc($q);
    		$displayName = ucwords("${r['firstname']} ${r['lastname']}");
    		?>
    		<script type="text/javascript" src="../assets/js/lightbox.js"></script>
    		<div class="lightBoxCover" id="lightBoxCover"></div>
    		<div class="lightBoxCon">
    			<div class="css3Lightbox" >
    				<div class="closeCross" id="lightBoxCloseButton"></div>
    				<div class="css3LbBorder1">	
    					<div class="css3LbBorder2">
    						<h1>
    							<?php echo "${displayName}'s personal partners";?>
    						</h1>
    						<?php 
    						// $partnersQ = mysql_query("SELECT `partners`.`userId2`, `users`.`id`, `users`.`firstname`, `users`.`lastname`, `users`.`imagename` FROM users, partners WHERE `partners`.`userId1` = '${r['id']}'")
    						// $numrows = mysql_num_rows($partnersQ);
    						// if($numrows > 0)
    						// {
    							// echo "${displayName} currently has ${numrows} personal partners";
    							echo "${displayName} currently has 2 personal partners";
    							// while($partnersR = mysql_fetch_assoc($partnersQ))
    							// {?>
    									<ul class="partnersList">
    										<li>
    											<div class="aviSmall">
    												<!--<img src="/assets/img/avatars/DeS8nbh3.jpeg" />-->
    											</div> 
     
    										</li>
    										<li>
    											<div class="aviSmall">
    												<!--<img src="/assets/img/avatars/test.jpg" />-->
    											</div> 
     
    										</li>
    									</ul>
    								<?php
    							// }
    						// }
    						// else
    						// {
    							// echo "${displayName} currently has no personal partners";
    						// }
    						?>
    					</div>
    				</div>
    			</div>
    		</div>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,197
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Im not following, you posted some jQuery code and some PHP/HTML code but no Ajax code?

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SgtLegend View Post
    Im not following, you posted some jQuery code and some PHP/HTML code but no Ajax code?
    The PHP/HTML code is being generated by the ajax.

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,182
    Mentioned
    16 Post(s)
    Tagged
    4 Thread(s)
    You probably need to use the JQuery live method rather than click.
    The only code I hate more than my own is everyone else's.

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    You probably need to use the JQuery live method rather than click.
    Thank you soo much. The live function worked wonders!


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
  •