The below code works as far as I can tell except for the var tid and var open section. They are being submitted from an image href:
$("#chngeHref").click(function() {
var tid = $('tid').attr('value'); // VARIABLES DONT WORK
var open = $('open').attr('value'); // VARIABLES DONT WORK
$.ajax({
type: "POST",
url: "update.php",
data: "tid="+ tid +"& open="+ open,
success: function(){
$('#chnge').fadeTo('slow',0.4);
}
});
});
HTML code this is coming from:
<a href="#" id="chngeHref" /><img src="<?php echo "image.php?url=" . $row[2]; ?>?tid=<?php echo $row[0]; ?>&open=<?php echo $row[1]; ?>" id="chnge" /></a>
Which works perfectly fine (output: image.php?url=image.jpg?tid=1&open=1). The issue is I don't think I have the var tid/open set up right to actually read the variables and pass them onto my mysql page (where I need to values to update the db). I have tried:
var tid = $('tid').attr('value');
var tid = $('.tid').attr('value');
var tid = $('#tid').attr('value');
I just don't know enough to make it work. Any suggestions are much appreciated.
Phillip.