Run PHP file without updating page [duplicate]

-1

I have a list of products, when clicking on some product, will go to another PHP file and do the calculations and go back to the products page.

But if I click on a product that is near the bottom of the page, when it comes back on this product page, the user will go back there at the top of the site because the page has been updated.

How to execute commands from another PHP file when clicking on an IMAGE without refreshing the page?

You can put some example, type: PRODUCT IMAGE

File (check.php) will do:

<?php
$credito = "30.00";
$id = $_GET['id'];
$valor = $_GET['valor'];
if($valor > $credito){ 

echo "<script type='text/javascript' language='javascript'> alert ('Você ultrapassou seu limite de crédito!'); window.location.href='carrinho.php'; </script>";

}else{

header("Location: produtos.php");

}

?>

That is, when I go back to page productos.php will refresh the page, how can I not refresh the page?

    
asked by anonymous 05.03.2014 / 20:11

1 answer

0

Dude, what you can do is put the product scripts that are giving error on the same page if it is possible, if you put the code would be easier to understand.

    
05.03.2014 / 20:22