Mike Waller
asked on
saving a script source result into a variable
I am calling a javascript that returns a string of data. So the code looks like <script src='[big url of custom data]'></script> and this then drops a string of text on the screen (in this case a latest tweet). The issue is that I want the text to be a link. I know I cannot do <a href=''><script src=''></script></a> but that is the result I am after. I want to turn the returned value into a link. I already have what it should point to.
Any ideas experts?
Any ideas experts?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I know basic js, should have specified this. The issue is that I do not have the values to set a variable. I have only a third-party script to call an API via a script src value. The upshot is calling the third party script does not return variables, per se, but returns a value that is dropped on the page. Make sense? Sorry I don't have code, but this is theoretical at this point. The following does not work, bit it illustrates my issue:
All I do is call a third part script. I don't have to write js in this script. I just paste a script call.. I wish I could do something like 'var foo=<script-that-is-a-blac k-box-and- returns-a- string-pla cing-it-on -a-web-pag e>' and then do something with foo.
All I do is call a third part script. I don't have to write js in this script. I just paste a script call.. I wish I could do something like 'var foo=<script-that-is-a-blac
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks!
ASKER