Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/11/2010, 03:37
maengora2010
 
Fecha de Ingreso: noviembre-2010
Ubicación: MEDELLIN
Mensajes: 2
Antigüedad: 13 años, 6 meses
Puntos: 0
Conflicto entre Jquery y Ajax

Estimados,

Tengo un código ajax que lo que hace el código de ajax es recuperarme la información de la base de datos cuando el doc_identidad ingresado existe y el resultado lo ubica en sus respectivos inputs del form; pero al parecer cuando agrego código JQuery, como el de cambiarle el color a un párrafo al hacer click en el, éste no funciona.

El fragmento de código es este:

Código Javascript:
Ver original
  1. <script language="javascript" type="text/javascript" src="js/ajax.js"></script>
  2.      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>  
  3.    
  4.    
  5.     <script type="text/javascript">
  6.       var $j = JQuery.noConflict();
  7.       $j(document).ready(function(){
  8.          $j("p").click(function(){
  9.            $j(this).css("background-color","red");
  10.          });
  11.       });
  12.      
  13.     </script>
  14.    
  15.     <script type="text/javascript">
  16.     var ajax = new sack();
  17.     var currentdoc_identidad=false;
  18.     function getClientData()
  19.     {
  20.         var doc_identidad = document.getElementById('doc_identidad').value.replace(/[^0-9]/g,'');
  21.         if(doc_identidad.length >=7 && doc_identidad!=currentdoc_identidad){
  22.             currentdoc_identidad = doc_identidad
  23.             ajax.requestFile = 'getUsuario.php?getdoc_identidad='+doc_identidad;    // Specifying which file to get
  24.             ajax.onCompletion = MostrarDatos;   // Specify function that will be executed after file has been found
  25.             ajax.runAJAX();     // Execute AJAX function           
  26.         }
  27.        
  28.     }
  29.    
  30.     function MostrarDatos()
  31.     {
  32.         var formObj = document.forms['FormPrueba'];
  33.         eval(ajax.response);
  34.     }
  35.    
  36.    
  37.     function initFormEvents()
  38.     {
  39.         document.getElementById('doc_identidad').onblur = getClientData;
  40.         document.getElementById('doc_identidad').focus();
  41.     }
  42.    
  43.    
  44.     window.onload = initFormEvents;
  45.     </script>

Agradezco cualquier colaboración.