php - ajax link json datatype call -
i want send data via ajax other page. have isolated problem. code.
thank help..but no effect..
updated code
it worked...
<script> $(document).ready(function(){ $(".edit").click(function(event) { event.preventdefault(); //<--- prevent default behaviour var box = 1233; var size=123; var itemname=123; var potency=123; var quantity=12333; var datastring ={ 'box' :box, 'size':size , 'itemname':itemname, 'potency':potency, 'quantity':quantity }; $.ajax({ url: "dd.php", type: "post", data: datastring, success: function(data) { alert(data); }, error: function(data) { alert(data); } }); }); }); </script>
so click link,it navigates, dd.php has
<?php echo json_encode(array('itemcode'=>$_post['itemname'])); echo $_post['itemname']; ?>
i object object alert. doing wrong? pls throw light here..thanks you..
$(document).ready(function(){ $(".edit").click(function(event) { event.preventdefault(); var data = {"box":1233, "size":565, "itemname":565, "potency":876, "quantity":234}; $.ajax({ url: "dd.php", type: "post", data: data, datatype: "json", success: function(data) { if(console){ console.log(data); } }, error: function(data) { if(console){ console.log(data); } } }); }); });
Comments
Post a Comment