2010-06-10 2 views
0

j'ai besoin de code pour la prochaine step..this ma première étape:données dans le show mysql après division de codes à barres et correspond à caractère

<script> 
$("#mod").change(function() { 
     var barcode; 
     barCode=$("#mod").val(); 
      var data=barCode.split(" "); 
      $("#mod").val(data[0]); 
      $("#seri").val(data[1]); 
     var str=data[0]; 
     var matches=str.matches(/EE|[EJU]).*(D)/i); 
     }); 
</script> 

après matches..i veulent le résultat peut se connecter à la base de données puis show données de la table à l'intérieur <div id="value"> ... comment faire cela?

Répondre

1

Vous devrez le faire en utilisant un appel ajax (les correspondances seront un paramètre pour l'appel). Le script php appelé via ajax devra récupérer les données et les restituer à la page appelante. Là, vous devrez analyser la réponse ajax et afficher ce que vous voulez. Un tutoriel utile can be found here.

+0

voir ma réponse .. – klox

0
<script> 
$("#mod").change(function() { 
     var barcode; 
     barCode=$("#mod").val(); 
      var data=barCode.split(" "); 
      $("#mod").val(data[0]); 
      $("#seri").val(data[1]); 
     var str=data[0]; 
     var matches=str.matches(/EE|[EJU]).*(D)/i); 

     $.ajax({ 
        type:"post", 
        url:"process.php", 
        data:params, 
        cache :false, 
        async :false, 
        success : function() { 
              alert("Data have been input"); 
              $("#value").html(matches); 


              return this; 
            }, 
        error : function() { 
              alert("Data failed to input."); 
            } 
      }); 
      return false; 

     }); 
</script> 

et je change mon process.php devenir:

select itemdata as version from settingdata where version = "tunerrange"; 
+0

N'êtes-vous pas maintenant .. utilise jQuery pour 'ajaxObj'? – Reigel

+0

owh..i invité ajxObj est la syntaxe jQuery..peut-être que je dois modifier ma réponse .. – klox

+0

pourrais-je faire comme ça? – klox

Questions connexes