Feedback on: irt.org FAQ Knowledge Base Q5604
Worth:
Worth reading
Comments:
You may want to pass the info along as a hidden input to a form as well... this is using the same idea as above, but here's another way to implement it:
This example is using VBScript instead of javascript.
firstname = "adam";
document.write(\"<input type=hidden name=firstname value=\" & firstname & \">\")
When the form is submitted, your perl code now has full access to the "$firstname" variable.
Worth:
Very worth reading
Length:
Too short
Comments:
Please correct me if I am worng but the eval i this example would return 'undefined' because the string does no correspond to valid
object.
Comments:
The javascript and assumption on this page is not correct.I have had a few confused
var firstname = 'Jason'; // JavaScript variable containing firstname
var URL = eval('http://www.server.com/cgi-bin/script.pl?firstname=' + firstname);
document.location.href = URL;
1. Why the eval????
2. It is window.location, not document.location one should use.
document.location is in principle read only, It is only to be compatible with older wrong scripts that it is kept on as a location changer
I would code it like this:
var firstname = 'Jason';
window.location = 'http://www.server.com/cgi-bin/script.pl?firstname=' + firstname;
and it should be mentioned that the page the user is looking at will be replaced by whatever script.pl returns unless it returns a 304 nothing changed http header.
Michel