I am creating an Ajax/PHP based console-type-thing, where basically the user enters a command at the prompt, it gets sent to a PHP script to get chewed up and processed, and a string of crap comes back out to be displayed.
I would like to know if anyone knows a nifty way in Javascript that I can check if certain flags are present in the return from the server, known as the variable req.responseTex t.
Some examples:
Any help is greatly appreciated.
I would like to know if anyone knows a nifty way in Javascript that I can check if certain flags are present in the return from the server, known as the variable req.responseTex t.
Some examples:
Code:
// Server Returns:
<br />{p}Please enter your password:
// Java should see the {p} as a flag, and the equivalent should occur:
document.getElementById("input").type='password'; // Line 1
output = "Please enter your password:"; // Line 2
// As you see, I need several lines similar to the first to execute
// whenever a flag is found, and multiple flags should each work,
// such as {c}{p}.
// I would also like to be able to use paramaters, such as:
{m=location_mapped, 90, 100}Server Return Text
// So that it would process if the flag was "m" with three parameters equal to location_mapped, 90, and 100.
Comment