www.webdeveloper.com
Results 1 to 2 of 2

Thread: JQuery + no target = problem

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    JQuery + no target = problem

    Hello Guys,

    I've got a very strange behavior :

    So this is my code :

    javascript :
    Code:
    	<script type="text/javascript" src="./js/jquery-1.6.1.min.js"></script>
    <script type="text/javascript">
    
    
    	jQuery(function($){
    		$('div.thumb').click(function(){	
    			var theID =  this.id;
    			
    			// Vérifier le header du fichier  ajax_update3.php
    			
    			$.get("ajax_update3.php", { "idpourphp": theID }, function(data, textStatus, jqXHR) {
    				console.log(data, textStatus, jqXHR);
    				
    				// succès de la transaction, traité le contenu de data
    				
    			}).error(function(jqXHR, textStatus, errorThrown){
    				console.log(jqXHR, textStatus, errorThrown);
    				
    				// échec de la transaction, gèrer la catastrophe
    				
    			});
    		});
    	});
    
    </script>
    ajax_update3d.php :
    Code:
    <?
    require_once("./connect.php");
    $id  = ($_GET['idpourphp']) ;
    
    $requete = "UPDATE  `BD`.`principal` SET  `down` =  '1' WHERE  `principal`.`id` ='".$id ."'";
    if(mysql_query($requete))  
    	{echo '1';}
    else  
        {echo '0';}  
    mysql_close();  
    ?>

    Generated HTML :

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> 
    
    <head> 
    
    	<title>BDthequeSerie</title>
    
    	<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8">
    
    	<script type="text/javascript" src="./js/jquery-1.6.1.min.js"></script>
    
    <script type="text/javascript">
    
    	jQuery(function($){
    
    		$('div.thumb').click(function(){	
    
    			var theID =  this.id;
    
    			// Vérifier le header du fichier  ajax_update3.php
    
    			$.get("ajax_update3.php", { "idpourphp": theID }, function(data, textStatus, jqXHR) {
    
    				console.log(data, textStatus, jqXHR);
    
    				// succès de la transaction, traité le contenu de data
    
    			}).error(function(jqXHR, textStatus, errorThrown){
    
    				console.log(jqXHR, textStatus, errorThrown);
    
    				// échec de la transaction, gèrer la catastrophe
    
    			});
    
    		});
    
    	});
    
    </script>
    
      </head>
    
      <body>
    
    <div id="mere"></div>
    <div id="5682" class="thumb">
    	<a href="../M/Mic Mac Adam - Nouvelles Aventures de (Les)/T01 - Les Amants Decapites.cbr" target="_blank"> 
    		<img class="ombrage3" src="../M/Mic Mac Adam - Nouvelles Aventures de (Les)/T01 - Les Amants Decapites.jpg" width="200" height="260" >
    	</a>
    	<div class="tick" style="display: block ">
    		<img src="./images/principal/tick1.png" >
    	</div>
    </div>
    <div id="5683" class="thumb">
    	<a href="../M/Mic Mac Adam - Nouvelles Aventures de (Les)/T02 - Le Roi Barbare.cbr" target="_blank"> 
    		<img class="ombrage3" src="../M/Mic Mac Adam - Nouvelles Aventures de (Les)/T02 - Le Roi Barbare.jpg" width="200" height="260" >
    	</a>
    	<div class="tick">
    		<img src="./images/principal/tick1.png" >
    	</div>
    </div>
    
      </body>
    </html>
    So when target tag is equal to _blank or something else (except _self) everything works great.

    Code:
    GET http://192.168.0.224/BD/web/ajax_update3.php?idpourphp=5682  
    200 OK  109ms	
    1 success Object { readyState=4, responseText="1", status=200, statusText="success"}
    But when target tag doesn't exit (W3C compliant) or equal _self, it stops working

    Code:
    GET http://192.168.0.224/BD/web/ajax_update3.php?idpourphp=5682
    idpourphp	5682
    Object { readyState=0, status=0, statusText="error"} error

  2. #2
    Join Date
    Jun 2011
    Posts
    2
    So nobody have a Clue ? Please!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles