I know you can do the opposite, and that you can't change a php value from js which is defined outside of js(at least as far as I know?), but what about a php variable which is defined inside of a js var. per say:
function captureID(clicked_id){
var clickedVar = (clicked_id);
var alert_type = document.getElementById(clickedVar).getAttribute('class');
var infoVar = document.getElementById(clickedVar).getAttribute('value');
var usernameVar = "<?php
$fetch_username = mysql_query('SELECT info FROM alerts WHERE id = "clickedVar"');
while ($row = mysql_fetch_array($fetch_username)){
$username = $row['username'];
}
if (alert_type == 'b_alert'){
var type = 'battle';
} else if (alert_type == 'a_alert'){
var type = 'award';
} else if (alert_type == 'f_alert'){
var type = 'friend';
}
alert(type);
if (type == 'battle'){
document.getElementById('battle_username').text(<?php echo $username; ?>)
} else if (type == 'award') {
} else if (type == 'friend'){
}
}
and then again using the variable inside of the js script. is this a possibility? because it's not seeming to work. no distinct errors, just not working.