Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá tenho um gohorse bem grande aqui e acho que ninguem nunca viu algo parecido rsrs eu to tentando aplicar um ajax tem 1 hora aqui e não consigo diagnostica o problema... o ajax vou por até separado para vocês não se perderem rsrssr então eu estou tentando pegar keyup de um formulário que tem id de gohorse kkk e nisso ele não funciona o ajax... ai eu coloquei FORM no ajax para tentar alguma coisa e também nada, alguém me ajuda pelo amor de Deus meu ajax perdido no codigo seguinte é este:
$("form").keyup(function(){ $.ajax({ url: "calc_.php", type: "POST", data: $(this).serialize(), success: function(data){ $('.res').html(data). } }). }). este é o codigo (NÃO ME PERGUNTEM PORQUE O CONTEUDO ESTA DENTRO DE VARIAVEL KKKKKKKK) <?php
session_start(). $_SESSION['clienteveei'] = $_POST['cliente']. if(isset($_GET['cadastrar'])){ include "app/faturamento47.php". }
mysql_query("DELETE FROM temp_lancamento"). mysql_query("DELETE FROM temp_cartao_lancamento"). $texto ='<script type="text/javascript" src="js/jquery.maskedinput-1.2.2.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#empre").focus(). $(".data").mask("99/99/9999"). $(".cnpj").mask("99.999.999/9999-99"). $(".cpf").mask("999.999.999-99"). $(".cep").mask("99999-999"). $(".fone").mask("(99)9999-9999"). $(".rg").mask("99.999.999.-9"). //$("#submit").hide(). //$("#limpar").hide(). }). function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){ var sep = 0. var key = \'\'. var i = j = 0. var len = len2 = 0. var strCheck = \'0123456789\'. var aux = aux2 = \'\'. if(navigator.appName == \'Microsoft Internet Explorer\'){ var whichCode = e.keyCode. }else if(navigator.appName == \'Netscape\'){ var whichCode = e.which. } if (whichCode == 13) return true. key = String.fromCharCode(whichCode). // Valor para o código da Chave if (strCheck.indexOf(key) == -1) return false. // Chave inválida len = objTextBox.value.length. for(i = 0. i < len. i++) if ((objTextBox.value.charAt(i)!= \'0\') && (objTextBox.value.charAt(i)!= SeparadorDecimal)) break. aux = \'\'. for(. i < len. i++) if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i). aux += key. len = aux.length. if (len == 0) objTextBox.value = \'\'. if (len == 1) objTextBox.value = \'0\'+ SeparadorDecimal + \'0\' + aux. if (len == 2) objTextBox.value = \'0\'+ SeparadorDecimal + aux. if (len > 2) { aux2 = \'\'. for (j = 0, i = len - 3. i >= 0. i--) { if (j == 3) { aux2 += SeparadorMilesimo. j = 0. } aux2 += aux.charAt(i). j++. } objTextBox.value = \'\'. len2 = aux2.length. for (i = len2 - 1. i >= 0. i--) objTextBox.value += aux2.charAt(i). objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len). } return false. } </script> <link rel="stylesheet" href="[http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css](http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css)" /> <script type="text/javascript" src="js/jquery-ui.js"></script> <script type="text/javascript" > $(function() { $( "#datepicker" ).datepicker({ dateFormat: "dd/mm/yy" }). }). </script> <p class="titulo">Faturamento - Cadastrar</p>
<div id="form" style="width:550px. margin:auto. "> <table width="550px" style="background-color: #efefef. border: 1px solid #dadada"> <tbody> <form method="post" id="pesCli" action="?pag=47&id=1" enctype="multipart/form-data"> <tr> <td> <span class="nomes">Cliente:</span> <select name="cliente" style="width:550px. " id="clientes"> '. if($_POST['cliente'] == NULL){ $texto.=' <option value="">-- Selecione o Cliente --</option>'. }else{ $selectCliente2 = mysql_query("SELECT * FROM cliente WHERE id = '".$_POST['cliente']."'"). $d = mysql_fetch_array($selectCliente2). $clientedopost = $d['empresa']. $texto.=' <option value="'.$_POST['cliente'].'">'.$clientedopost.'</option>'. } $selectCliente = mysql_query("SELECT * FROM cliente ORDER BY empresa ASC"). while($clientes = mysql_fetch_array($selectCliente)){ $selected = "". if($_POST["cliente"] == $clientes["id"]){ $selected = "selected='selected'". } $texto.='<option value="'.$clientes["id"].'" '.$selected.'>'.$clientes["empresa"].'</option>'. } $texto.='</select> <script type="text/javascript" > $("#clientes").change(function(){ $(\'#pesCli\').submit(). }). </script> </td> </tr> </form>'. if(isset($_POST["cliente"])){ $texto.=' <form method="post" id="gohoser" action="?cadastrar&pag=47&id=1" enctype="multipart/form-data"> <input type="hidden" value="'.$_POST["cliente"].'" name="clienteFim" id="clienteFim" /> <tr> <td><span class="nomes" style="margin-top:5px. margin-left:10px. " >Data: </span> <input type="text" name="data" id="datepicker" style="width:100px. float:left" /> <span class="nomes" style="margin-top:5px. margin-left:10px. " >'.utf8_decode("Nº").' de caixa: </span> <input type="text" name="ncaixa" style="width:100px. float:left" /> </td> </tr> <tr> <td style="text-align:center. "> <span class="nomes2" style="font-size:14px. "><b>Lançamentos do Dia</b></span><br /> <u> </u> </td> </tr> <tr> <td> <br /> <span class="nomes" style="margin-top:5px. margin-left:10px. " >Danfe: </span> <input type="text" name="danfe" id="danfe" style="width:100px. float:left" /> </td> </tr> <tr> <td> <span class="nomes" style="margin-top:5px. margin-left:10px. " >Dinheiro: </span> <input type="text" name="dinheiro" id="dinheiro" style="width:100px. float:left" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /> <span class="nomes" style="margin-top:5px. margin-left:10px. " >Cheque: </span> <input type="text" id="cheque" name="cheque" style="width:100px. float:left" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /> <br /><br /> <span class="nomes" style="float:none. " ><u><b>Cartões de Débitos</b></u></span> <br /><br /> <div id="debito" style="float:left. width:100%. ">'. $selectCartDeb = mysql_query("SELECT * FROM cartoes WHERE id_cliente = '".$_POST["cliente"]."' AND tipo = '1' ORDER BY admcart"). $cont = 1. while($debito = mysql_fetch_array($selectCartDeb)){ if($cont == 1){ $texto.='<div style="float:left. min-width:230px. text-align:right. margin-left:10px. "><input type="text" name="cartao'.$debito["id"].'" id="cartao'.$debito["id"].'" style="width:100px. float:right" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /><span class="nomes" style="margin-top:5px. margin-right:10px. float:right. " >'.utf8_decode($debito["admcart"]).' '. utf8_decode($debito["bandeira"]).': </span> </div>'. $cont++. }else{ $texto.='<div style="float:right. min-width:230px. text-align:right. margin-right:10px. "><input type="text" name="cartao'.$debito["id"].'" id="cartao'.$debito["id"].'" style="width:100px. float:right" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /><span class="nomes" style="margin-top:5px. margin-right:10px. float:right. " >'.utf8_decode($debito["admcart"]).' '. utf8_decode($debito["bandeira"]).': </span> </div>'. $cont = 1. } } $texto.='</div> <br /><br /> <span class="nomes" style="float:none. " ><u><b>Cartões de Créditos</b></u></span> <br /><br /> <div id="credito" style="float:left. width:100%. "> '. $selectCartCre = mysql_query("SELECT * FROM cartoes WHERE id_cliente = '".$_SESSION["clienteveei"]."' AND tipo = '2' ORDER BY admcart"). $cont = 1. while($credito = mysql_fetch_array($selectCartCre)){ if($cont == 1){ $texto.='<div style="float:left. min-width:230px. text-align:right. margin-left:10px. "><input type="text" name="cartao'.$credito["id"].'" id="cartao'.$credito["id"].'" style="width:100px. float:right" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /><span class="nomes" style="margin-top:5px. margin-right:10px. float:right. " >'.utf8_decode($credito["admcart"]).' '. utf8_decode($credito["bandeira"]).': </span> </div>'. $cont++. }else{ $texto.='<div style="float:right. min-width:230px. text-align:right. margin-right:10px. "><input type="text" name="cartao'.$credito["id"].'" id="cartao'.$credito["id"].'" style="width:100px. float:right" onKeyPress="return(MascaraMoeda(this,\'.\',\',\',event))" /><span class="nomes" style="margin-top:5px. margin-right:10px. float:right. " >'.utf8_decode($credito["admcart"]).' '. utf8_decode($credito["bandeira"]).': </span> </div>'. $cont = 1. } } $texto.='</div> </td> </tr> <tr> <td> </td> </tr> <tr> <td style="text-align:left. "> <label><input type="checkbox" value="1" name="meianoite" id="meianoite" style="float: left. margin-left:10px. "/> Após às 00:00h.</label> </td> </tr> <tr> <td id="campos"> <input type="hidden" value="0" name="periodo" id="periodo" /> <br /><div class="add" style="cursor:pointer. width: 260px. margin:auto. "><u>Adicionar outro lançamento no dia</u></div> </td> </tr> <script type="text/javascript"> $(function(){ $(".add").click(function(){ var peri = parseInt($("#periodo").val()) + 1. $("#periodo").val(peri). $.getJSON(\'cadastrarLancamentos.ajax.php?search=\',{cliente: $("#clienteFim").val(),'. $selectCart = mysql_query("SELECT * FROM cartoes WHERE id_cliente = '".$_POST["cliente"]."'"). while($cartao = mysql_fetch_array($selectCart)){ $texto.='cartao'.$cartao["id"].': $("#cartao'.$cartao["id"].'").val(),'. } $texto.='data: $("#datepicker").val(),dinheiro: $("#dinheiro").val(),danfe: $("#danfe").val(),cheque: $("#cheque").val(),periodo: $("#periodo").val(),meianoite: $("#meianoite").val(),ajax: \'true\'}, function(j){ var options = \'<table style="margin-top: 25px. ">\'. options += \'<tr>\'. options += \' <td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \'Danfe\'. options += \'</span>\'. options += \'</td>\'. options += \' <td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \'Data\'. options += \'</span>\'. options += \'</td>\'. options += \'<td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \' Dinheiro\'. options += \' </span>\'. options += \'</td>\'. options += \'<td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \'Cheque\'. options += \'</span>\'. options += \'</td>\'. options += \'<td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \'Total de Crédito\'. options += \'</span>\'. options += \'</td>\'. options += \'<td style="min-width:120px. height: 20px. background-color: #CCC. padding-top:5px. text-align:center. "><span style="color: #000000. font-weight:bold. font-family:Tahoma, Geneva, sans-serif. ">\'. options += \'Total de Débito\'. options += \'</span>\'. options += \'</td>\'. options += \'</tr> \'. for (var i = 0. i < j.length. i++) { options += \'<tr class="proc">\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5.. ">\'. options += j[i].danfe. options += \'</td>\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5.. ">\'. options += j[i].data. options += \'</td>\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5">\'. options += j[i].dinheiro. options += \'</td>\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5">\'. options += j[i].cheque. options += \'</td>\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5">\'. options += j[i].totalDeb. options += \'</td>\'. options += \'<td align="center" style="width:696px. min-height: 23px. border-bottom: 1px solid #dadada. background-color: #f5f5f5">\'. options += j[i].totalCred. options += \'</td>\'. options += \'</tr>\'. } $(\'#selProds\').html(options).show(). }). $("#clientes").attr(\'disabled\', \'disabled\'). $("#submit").show(). $("#meianoite").attr(\'checked\', false). $("#limpar").show(). $("#dinheiro").val(""). $("#cheque").val(""). '. $selectCart = mysql_query("SELECT * FROM cartoes WHERE id_cliente = '".$_POST["cliente"]."'"). while($cartao = mysql_fetch_array($selectCart)){ $texto.='$("#cartao'.$cartao["id"].'").val(""). '. } $texto.='}). }). </script> </tbody> </table>
</div>
</div> <div id="selProds"> </div> <br /><a href="?pag=47&id=1"><img src="images/limpar.jpg" id="limpar" /></a> <input type="submit" id="submit" value="Finalizar lançamentos" alt="Finalizar lançamentos" onclick="excT()" />'. } $texto.=' </form> <div class="res">MAIS UM TDT</div> </div>
<br />
<br />
'.?> Ola o post duplicou um monte de vocês, algum moderador pode retirar?Carregando comentários...