Sending value from JavaScript to PHP via ajax OnUpDtae -
i trying send value 'idselected' javascript update php variable using onupdate (when user clicks button). javascript gets values magictoolbox.com image tool , when set alert value shown correctly within javascript bit works fine.
i can not seem able php variable value change onupdate when use action (button press) has value.
<script type="text/javascript"> var mzoptions = {}; mzoptions = { onupdate: function() { jquery('.magiczoom').next().html(jquery(arguments[2]).attr('title')) ; $idselected = jquery(arguments[2]).attr('data-product-id') ; $.ajax({ url: "http://malonef.truska.co.uk/product/18", type: "post", data: { idselected: $idselected } ; }); } } ; </script>
and php
<a id="moodboxclick" data-id="<?php echo $_post['idselected'] ; ?>"> <button type="button" class="btn btn-primary btn_moodboard">add colour moodboard</button> </a>
in addition how set value of url current page - can use php
$_server['remote_addr']or need passed in show how. ## on end changes (18 in case)
Comments
Post a Comment