Thread Tools Display Modes
08-12-08, 08:18 AM   #1
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Question A Javascript equivalent to RunScript?

As the title says, any Javascript experts that can tell me if there is a RunScript equivalent? Using jQuery to query a PHP script that responds with a message, but if the message contains the text {js:<javascript code>} it will parse it but for now I can't do anything except just displaying the Javascript code as a alert, I would like to run it instead.

http://vlacula.no-ip.com/jquery/ (Test #3 and #4, you will see what I mean. *wink*)

Hope someone here can help me out! ^^
  Reply With Quote
08-14-08, 08:28 AM   #2
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
It's been forever since I've used Javascript, however I think the function you are looking for is exec()

EDIT: I was close eval()
http://www.w3schools.com/jsref/jsref_eval.asp
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
08-14-08, 11:27 AM   #3
VgerAN
A Cyclonian
 
VgerAN's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 40
eval() will do it. You should make sure that you know where the string is coming from if you use eval() -- if it's coming directly from your server, that's fine; you should just make sure that it isn't something that another user has control over. (If another user had control over it, they could, for example, steal login cookies, record password, and so on -- most anything that you as the site author could do.)
  Reply With Quote
08-15-08, 01:02 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Thumbs up

Thank you very much.

About the response, yeah it's all decided by me.. hehe. But it's nice for temporary links that expire and such, for example you have to enter in the correct keyword that the PHP will check and if matching respond with the temporary link that the user will be redirected to. Me like...

Ty all
  Reply With Quote

WoWInterface » General Discussion » Chit-Chat » A Javascript equivalent to RunScript?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off