So, I'm trying to solve a pretty simple problem here but the best part of 4 hours later I still have no idea. I'd just like to take the variable z and convert it to php so I can use the value in an array. At the moment I have managed to convert the value to php in another file now I need to get it back to the original file to use and that's where I've hit a wall. I've included the relevant code below.
orders2.php Takes the javascript value of z and makes it PHP using another file
(function($) {
$(document).on('click', '.rowclick',function() {
var z = 2;
alert(z);
var post = $.post('../../wp-content/themes/alma-child/includes/modes.php',{z:z});
post.done(function(data){
<?php
$rownum = $_GET['z2'];
echo "nei";
?>
})
$("#myModal1").modal();
});
})(jQuery);
the modal part in orders2.php
<div id="myModal1" class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="account_modal_body">
<button class="close" type="button" data-dismiss="modal">Close Window</button>
<div id="missing">
<form action="#" id="form" method="post" name="form">
<div id="printthis">
<h2>Track Mastering Details</h2>
<label>Track Name</label>
<div class="subsec">
<?php echo $waiting[$z2][0] ?>
</div>
<label>Artist</label>
<div class="subsec">
<?php echo $waiting[$z2][1] ?>
</div>
<label>Duration</label>
<div class="subsec">
<?php echo $waiting[$z2][2] ?>
</div>
<label>ISRC</label>
<div class="subsec">
<?php echo $waiting[$z2][3] ?>
</div>
<label>Mastering Notes</label>
<div class="subsec">
<?php echo echo $waiting[$z2][4] ?>
</div>
</div>
</form>
</div>
<button class="close" id="print" type="button">Print</button>
</br>
</div>
</div>
</div>
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
modes.php the other file This code is definitely not correct, I tried to take the jQuery from one of the previous solution but wasn't sure how it worked
<?php $z2=$ _POST['z']; ?>
<div id="uploads">
<?php echo $z2; ?>
</div>
<script>
jQuery('#uploads').load('orders2.php?account=<?php echo($z2);?>');
</script>
Notes: I realise this may not be the best way to do this, so any other solutions to convert a javascript variable to php would be appreciated. Also, just to mention I would like it if it was possible for the page not to refresh (hence javascript)