3
I’m giving an input in the database, Chrome works, firefox my request not success. Someone has already gone through this?
I switched the serialize() function and passed the values invidual, to see if that was it. I tested the passage of each value, all arrive on the other page the wheel Insert color. Only in firefox that does not do this.
$("#btnentrada").click(function(){
var txtplaca = $("#txtplaca").val();
var cmbtipo = $('#cmbtipo').val();
var txtmarca = $("#txtmarca").val();
var txtmodelo = $("#txtmodelo").val();
var txtcor = $("#txtcor").val();
var cmbcobranca = $("#cmbcobranca").val();
var txtobs = $("#txtobs").val();
$.ajax({
url: 'insere_entrada.php',
method: 'post',
data: {'txtplaca': txtplaca , 'cmbtipo': cmbtipo , 'txtmarca': txtmarca , 'txtmodelo' : txtmodelo , 'txtcor' : txtcor ,
'cmbcobranca' : cmbcobranca , 'txtobs' : txtobs},
success: function(data){
alert(data);
}
})
});
php
//verifica se as sessions estão preenchidas
include_once("status_logado.php");
require_once('db.class.php');
$placa = $_POST['txtplaca'];
//nao permite carcateres especiais
if ( !empty( $placa) && preg_match( '/^[\w\n\s]+$/i' , $placa ) ){
$tipo = $_POST['cmbtipo'];
$marca = $_POST['txtmarca'];
$modelo = $_POST['txtmodelo'];
$cor = $_POST['txtcor'];
$cobranca = $_POST['cmbcobranca'];
$obs = $_POST['txtobs'];
$objDb = new db();
$link = $objDb->conecta_mysql();
$sql = "INSERT INTO TBL_COBRANCA (COB_PLACA,COB_MARCA,COB_MODELO,COB_COR,COB_OBS,ID_TIPO) VALUES('$placa','$marca','$modelo','$cor','$obs',$tipo)";
if(mysqli_query($link,$sql)) {
echo "Dados inseridos com sucesso!";
}else {
echo("Erro na operação, contatar o administrador do sistema.");
}
} else {
echo "Só são permitidos letras e números";
die();
}
First thing: I already look at the browser console?
– Woss
I tested your ajax here and it worked, use the
Firefox
as a standard– Wees Smith
Related https://answall.com/questions/167/
– Costamilam