I have this code, to simple update "cupom" from "0" to "1", but it isnt working with Chrome, with firefox it does work, any help/advice is welcome.
var req;
function val_impressao_js(cpf) {
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
}
else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "val_impressao.php?cpf="+cpf;
req.open("GET", url, true);
req.onreadystatechange = function()
{
if(req.readyState == 4 && req.status == 200)
{
window.print();
}
}
req.send(null);
}
val_impressao.php
require "arqinc/conexao.php";
require "arqinc/funcoesbd.php";
$cpf=$_GET['cpf'];
$query=mysql_query("UPDATE cadcoo SET cupom=1 WHERE cpf_cadpessoafisica=$cpf AND cupom=0");
And by the way, this part isnt working too, it does not print the page.
if(req.readyState == 4 && req.status == 200)
{
window.print();
}