I have two ajax requests that i need to make that will return two elements of data and i want to only grab them once as the page loads
I was thinking of this approach but i was wondering is there a better
$(document).ready(function(){
$.get("/shop_possystems/index.php?route=module/cart/get_subtotal",
function(data) {
});
$.get("/shop_possystems/index.php?route=module/cart/get_tax",
function(data) {
});
});
the problem is how do i get this data to my php page so another thing i was thinking was along these lines
<script type="text/javascript">
$.get("/shop_possystems/index.php?route=module/cart/get_subtotal",
function(data) {
<?php $subtotal = data; ?>
});
$.get("/shop_possystems/index.php?route=module/cart/get_tax",
function(data) {
<?php $tax = data; ?>
});
</script>
as you can see i am trying to add a script tag in the php page and trying to set the values here....both ways seem a bit hacky, not to mention the second approach is probably not even correct syntax....any suggestions