0
I have a link that changes dynamically, the problem is when I do the concatenation not resume anything
<?php
$user_id = 1;
?>
<div id="link-bt">
<a href="javascript:void(0);" onClick="seguir('link-bt','Seguir','<?=$user_id;?>');">Seguir</a>
</div>
<script type="text/javascript">
function seguir(id,valor,user_id){
var insert = document.getElementById(id);
if(valor == "Seguir"){
insert.innerHTML = '<a onClick=cancelar("link-bt","Cancelar","'+user_id+'"); href="javascript:void(0);>Cancelar</a></li>';
}
}
function cancelar(id,valor,user_id){
var insert = document.getElementById(id);
if(valor == "Cancelar"){
insert.innerHTML = '<a onClick=seguir("link-bt","Seguir","'+user_id+'"); href="javascript:void(0);>Seguir</a></li>';
}
}
</script>
This correct is depends on the support php version, and try
<? echo $user_id; ?>
.– KingRider
@Kingrider is no problem with PHP ,as I ran a test using the alert("user_id"); and it was successful
– David
ok and but already solved? if you need help me skype chat live:Save... test code so
alert(user_id)
orconsole.log(user_id)
rss.. see comment said @lvcs below.– KingRider
All right here, thanks!
– David