Advertisement
gersonab

on

Jul 6th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.36 KB | None | 0 0
  1.  
  2. $(document).ready(function() {
  3.  
  4.    $('.adicionar').on('click','a',function(){
  5.         var id_p=$(this).attr("rel");
  6.         $.ajax({
  7.                type:"GET",
  8.                url:"carrinho.php",
  9.                data:{id_p:id_p,acao:"mais"},
  10.                success: function(atual){
  11.                    $(".car").html(atual);
  12.                }
  13.                });
  14.         return false
  15.                                      });
  16.    
  17.    $('.remover').on('click','a',function(){
  18.         var id_p=$(this).attr("rel");
  19.         $.ajax({
  20.                type:"GET",
  21.                url:"carrinho.php",
  22.                data:{id_p:id_p,acao:"menos"},
  23.                success: function(atual){
  24.                    $(".car").html(atual);
  25.                }
  26.                });
  27.         return false
  28.                                      });
  29.    
  30.  
  31. $(".txtqtd").blur(function(){
  32.                 var id_p=$(this).attr("id");
  33.                 var idqtd=$(this).val();
  34.                 $.ajax({
  35.                            type:"GET",
  36.                            url:"carrinho.php",
  37.                            data:{id_p:id_p, acao:"up", idqtd:idqtd},
  38.                            success: function(atual){
  39.                                    $(".car").html(atual)
  40.                            }
  41.                            });
  42.                 return false
  43.                                                                                   });
  44.  
  45.       $(function(){
  46.    $("a[rel~=external]").attr("target","_blank");
  47. });
  48.      
  49.    $(document).on('click','#btnenviar',function(){
  50.         var nome = $("#cliente_cli").val();
  51.         var email = $("#email_cli").val();
  52.         var end = $("#end_cli").val();
  53.         var bairro = $("#bairro_cli").val();
  54.         var cidade = $("#cidade_cli").val();
  55.         var est = $("#est_cli").val();
  56.         var cep = $("#cep").val();
  57.         var tel = $("#tel_cli").val();
  58.         var cel = $("#cel_cli").val();
  59.         if(nome=="" || email=="" || end==""  || bairro=="" || cidade=="" || est=="" || cep=="" || tel==""  || cel=="" ){
  60.             alert("O preenchimento dos campos do formulário é obrigatório");
  61.         } else {
  62.             $.ajax({
  63.                    type:"GET",
  64.                    url:"new_pedido_template.php",
  65.                    data:{cliente_cli:nome, email_cli:email, end_cli:end, bairro_cli:bairro, cid_cli:cidade, est_cli:est, cep:cep, tel_cli:tel, cel_cli:cel,},
  66.                    success: function(atual){
  67.                        $("#btnenviar").hide('slow');
  68.                        alert("Pedido enviado com sucesso!");
  69.                        window.close();
  70.                    
  71.                }
  72.                });
  73.         }
  74.        
  75.         return false
  76.                                      });
  77.    
  78.  
  79.    $(document).on("click",'#f_pedido',function(){
  80.         window.close();
  81.                                         });
  82.  });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement