Jump to content

jtgmagic

New Members
  • Posts

    2
  • Joined

  • Last visited

jtgmagic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. that is stange part in my website don't work. Yes the img tag where I click have the attribuite on it. console.log print the product id and success the problem is in descProduto.php is not geting the value (product id) don't understand why. any ideias? Thanks
  2. Hello I'm trying to pass a php variable from produto.php to another file descProduto.php it ajax but without success. Please someone can tell me what I'm doing wrong? The ajax is working fine but I can't get the value/variable on descProduto.php file index.php <script type="text/javascript" src="jquery-1.11.min.js"></script> <script type="text/javascript" src="ajax.js"></script> This is where I click file produto.php <img class="btn-details" src="plus.png" data-idproduto="'.$idproduto.'"/> My ajax file ajax.js $(function(){ $(".btn-details").on('click', function(){ var idproduto = $(this).data('idproduto'); $.ajax({ type: "POST", url: "descProduto.php", async: false, dataType: "html", data: {'idproduto': idproduto}, success: function(result){ console.log("success"); console.log(idproduto); }, error: function(){ console.log("error"); } }); return false; }); }); Where I get the variable file descProduto.php if(isset($_POST['idproduto'])){ $idproduto = $_POST['idproduto']; echo $idproduto; } I have print_r($_POST) and print a empty array() Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.