roundN = function (n,m) { return Math.round((n*Math.pow(10,m)))/Math.pow(10,m); } $(document).ready(function(){ $("a[@id=continue_shopping]").each(function() { $(this).click(function(){ var cw = $("input[@id=cwrap]").val(); var html = $.ajax({url: "./add.php5?cw="+cw, async: false}).responseText; }); }); $("input[@id=submit_code]").click(function() { var txt = $("input[@id=voucher]").val(); var discount = 0; if (txt.length > 0) discount = $.ajax({url: "./discount.php5?code="+txt, async: false}).responseText; if (discount > 0) window.location.reload(); }); });