Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/09/2014, 08:36
baravaro
 
Fecha de Ingreso: noviembre-2012
Mensajes: 97
Antigüedad: 11 años, 5 meses
Puntos: 1
Hacer consulta en jquery

Buenas, tengo este codigo jquery ( segun me han dicho)
Código Javascript:
Ver original
  1. $(document).on('click', ".btnBuyTicket", function(){
  2.     /*if(go_urlPW === false){ return false; }*/
  3.     var t = $(this), adult = $("input[name='PW[adult]']"), junior = $("input[name='PW[junior]']"),
  4.     altura_m1 = $("input[name='PW[altura_m1]']"), altura_s1 = $("input[name='PW[altura_s1]']"),
  5.     rForm = $(".PazPayForm"), follow = true, WaitPt = $(".WlshowCHoutB, .resumeCartInPla"),
  6.     PWdirect = $("input[name='PAERDirectPWarner']"), localizador = $("input[name='PW[ticketCode][]']");
  7.     /*  */
  8.     rForm.find("input, select").each(function(index, element) {
  9.         var tl = $(this);
  10.         if( $.trim(tl.val()) == '' ){ tl.focus(); follow = false; return false; }
  11.         else{
  12.             if(tl.is("input[name='PW[email]']") && email_validate( tl.val() ) === false){
  13.                 alert("Introduce un correo electrónico válido");
  14.                 tl.focus(); follow = false; return false;
  15.             }
  16.             if( tl.is("input[name='PW[phone]']") && !$.isNumeric(tl.val()) ){
  17.                 tl.focus(); follow = false; return false;
  18.             }
  19.         }
  20.     });
  21.     if(follow === false){ return false; }
  22.     if( $.trim(localizador.val()) == '' || $.trim(localizador.val()).length == 0 ){
  23.         alert("Introduce el número del localizador");
  24.         return false;
  25.     }
  26.     /*  */
  27.     if(PWdirect.size() == 0){ }
  28.     else{
  29.         follow = true;
  30.         totalt = $("input[name='PW[ticketNumber]']"), input_code = $("input[name='PW[ticketCode][]']");
  31.         if( $.trim(totalt.val()) == '' || !$.isNumeric(totalt.val()) || totalt.val() == 0 ){
  32.             totalt.focus(); return false;
  33.         }
  34.         input_code.each(function(index, element) {
  35.             if( $.trim( $(this).val() ).length == 0 || $(this).val().length < 4 ){
  36.                 $(this).focus(); follow = false; return false;
  37.             }
  38.         });
  39.         if(follow === false){ return false; }
  40.     }
  41.     if(follow === false){ return false; }
  42.     var ePhone = $("input[name='PW[phone]']");
  43.     if(ePhone.val().length != 9 || !$.isNumeric(ePhone.val())){
  44.         alert("Por favor, introduce un nº de teléfono válido.");
  45.         ePhone.focus(); return false;
  46.     }
  47.     follow = true; var tbcket = $(".btnBuyTicket");
  48.     /*  */
  49.     var payment_type = $("input[name='PW[payment]']:checked"),
  50.         add_toURL = '&PWamount=0&radPay=direct&vtsMessage=success&payWay=direct';
  51.     if(t.is('.btnBuyTicket') && PWdirect.size() > 0){
  52.         if(payment_type.size() > 0){
  53.             add_toURL = '&PWamount=10&radPay='+ payment_type.val() +'&payWay=' + payment_type.val() + '&comepagePW=1';
  54.         }
  55.         var bUrl = 'http://chauffeurvip.es/intRdSy/bl.php?vtsPayments=true&PWgratis=1&' + $(".PazPayForm").serialize() + '&vtsMessage=success' + add_toURL;
  56.         //alert( add_toURL ); return false; http://chauffeurvip.es
  57.         document.location = bUrl;
  58.         return false;
  59.     }
  60.     return false;
  61. });

No tengo ni idea de jquery...

EL caso es que estoy trabajando en una web con ajax y jquery por ahi...
Hay una variable (localizador) que lo uqe hace es recoger de un formulario un input con un numero...

Lo que quiero es saber como puedo hacer una consulta a la bd para saber si existe o no algun localizador con el mismo valor... como puedo hacerlo?