Is it possible to pass a string variable from SB to inline JS?
If so would somebody be kind enough to show me how it's done?
How to pass a string variable from SB to inline JS
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: How to pass a string variable from SB to inline JS
Code: Select all
Define myString.s = "World!"
!alert("Hello " + v_myString);
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: How to pass a string variable from SB to inline JS
Thanks, Peter.
Any idea how to make this work?
Any idea how to make this work?
Code: Select all
Procedure.s SayHello(myString.s)
!return "Hello " + v_myString;
EndProcedure
Debug SayHello("Peter")
Re: How to pass a string variable from SB to inline JS
this doesn't work at the moment due to this bug: http://forums.spiderbasic.com/viewtopic.php?f=11&t=38
Greetings ... Peter
Greetings ... Peter
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: How to pass a string variable from SB to inline JS
Thanks again, Peter.
Why is it necessary to prefix the variable name with 'v_' in the JavaScript code?
Why is it necessary to prefix the variable name with 'v_' in the JavaScript code?
Re: How to pass a string variable from SB to inline JS
because it's internal "compiled" code that you shouldn't be looking at?
I'm guessing to ensure that there isn't a conflict of variable names between all the javascript libraries and your code, so all variables are prefixed with "v_".
I'm guessing to ensure that there isn't a conflict of variable names between all the javascript libraries and your code, so all variables are prefixed with "v_".