I have this line of code:
<a href="#" id="profilelink" name="profilelink"
value="<?php echo $id."/".$block_record;?>"
onClick="return viewornot(<?php echo $id; ?>)">
<?php echo $uniqueCode; ?>
</a>
So with the onclick i want to pass the id concatenated with a blocked id to my JS:
function viewornot()
{
var val = document.getElementById('profilelink');
var e = confirm('Do you want to view this profile?');
if (e == true)
{
//for live site
window.location.href = "http://www.rainbowcode.net/index.php/profiles/showprofilepersonal?id="+id;
return true;
}
else
{
//if val contains a 1 then user is blocked
//display a message then
}
return false
}
the line: var val = document.getElementById('profilelink'); is not giving me what I want
it should contain the user id concatenated with a 1(blocked) or 0(not blocked)
($id."/".$blocked_user)
can someone help me please?
thank you
When you do
You’re actually working with the DOM element that is your link. What you actually want is the parameter that is being passed to your method.
Change your method signature
You might also want to change your link