javascript - how to pass url to another page using ajax -
this question has answer here:
i trying pass product id products.php page producttype.php using ajax.
products.php
<?php $test = $_get['id']; echo $test; ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="" src="action.js"></script>
producttype.php
<?php $id = $_get['id']; echo $id; ?>
action.js
$.ajax({ url: "products.php", success: function(data){ $.ajax({ url: "productstype.php?id="+data, success: function(data){ alert(data); } }); } });
you need convert variable:
$.ajax({ url: "products.php", success: function(data){ $.ajax({ url: "productstype.php?id=" + data, //------------------------^^^^^^^^^ }); } });
Comments
Post a Comment