View Full Version : JS: Retrieve userid
dsmcd01
09-08-2004, 01:33 PM
Hello...
I need to get the current userid from within a js file. I cannot send the userid to the javascript as a parameter (since this particular javascript file is part of a convoluted string of js and html files).
Any suggestions?
TIA,
D.
Modin
09-08-2004, 09:26 PM
before you call the .js file I believe you can set a js variable which will be in the scope of the .js file.
ie.
<script language="javascript">
myvar = 6;
</script>
<script language="javascript" src="yourjsfile.js"></script>
Then, yourjsfile.js should be able to see myvar... I think...
Not exactly sure on the syntax, but hopefully you get what I mean :)
dsmcd01
09-09-2004, 01:30 PM
Thanks. Either I'm in a catch-22 or my coding skills aren't up to the task. The js file that needs the userid is called by an html document which doesn't know the userid. The html is openned by yet another js which does know the userid. I haven't found a way to send the userid from the first js to the html and from there to the 2nd js file.
I'm trying to customize the PHPSpell hack (https://vborg.vbsupport.ru/showthread.php?t=65723) by enabling/disabling the Learn button depending on userid. I've asked there, but no response yet.
Of course now that I'm having trouble my manager wants the customization done asap. Funny how that works. "Oh, it's troublesome? In that case I need it even sooner and the priority just went up." Sheesh. :ermm:
Thx,
D.
Colin F
09-09-2004, 01:37 PM
to get it into the html page, I think you can fill it into a text field. And also read it from that text field. The thing is, where would you hide the textfield....
Maybe It'll help :)
Modin
09-09-2004, 09:33 PM
yeah, if you passed a hidden field, you could do it.... but that's very insecure since someone could just send the correct headers and see the button you're hiding...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.