PDA

View Full Version : Survey



crimsonsmeagol
06-23-2008, 03:19 PM
Is there anyway to use Javascript to do a survey? Basically I am looking for something that has one question and 2-4 possible choices and then display the percentage of each choice. Any ideas?
Thank you for any help.

jscheuer1
06-23-2008, 05:07 PM
No. Javascript may be used to enhance the user interface, but it cannot store survey (or any other results) for later tabulation, comparison, whatever.

You would need to use PHP, asp, or some other server side language for that.

There may be third party hosts that will do this for you (say if you don't want to learn a server side language or your host doesn't provide one), some perhaps even free. (Use Google to search for these)

Then again, as part of your hosting package, there may be available something just like this, all ready to go with minor configuration on your part. Ask your host.

magicyte
06-23-2008, 06:11 PM
Actually, it is very much possible to do a survey with JavaScript and a little bit of AJAX using query strings and cookies. It may take a while to code such program, but it would work. If this situation is actually very important, why don't you e-mail me at magicyte.programmer@gmail.com for any questions or requests. Hope this helps.

-magicyte

jscheuer1
06-23-2008, 06:23 PM
Actually, it is very much possible to do a survey with JavaScript and a little bit of AJAX using query strings and cookies. It may take a while to code such program, but it would work. If this situation is actually very important, why don't you e-mail me at magicyte.programmer@gmail.com for any questions or requests. Hope this helps.

-magicyte

I seriously doubt that this could be all that reliable. Are you going to write to a file on the host? Use server side cookies? Without one of these two things, results will be lost in many cases. Actually, without writing to a more or less permanent file of some sort on the server, there would be no cross availability of results between different users. This will require the host to support such an action. At that point, I imagine it would be much simpler to code in that supported language. This would also avoid problems with non-javascript and non-AJAX enabled users.

magicyte
06-23-2008, 06:40 PM
Yes! How could I forget PHP?! You would need it to store the information for later use. I do have a question though. Would you need to use PHP or JavaScript to take the information and show percentages of the choices of people who were surveyed? I'm guessing PHP, but of course you would need JavaScript to display it. Or not?

-magicyte

magicyte
06-24-2008, 02:54 AM
Aha! I have yet an other form of storing the percentages using AJAX, JavaScript, and XML. You can give the survey using JavaScript, take the value of the survey, and then use a little bit of AJAX to send it to XML which can then be accessed later. But then again, you are right about the users who's browser's do not allow AJAX or JavaScript. I mean, you could use PHP and the code would be of little length, and vice versa, but for me, I would prefer AJAX, JavaScript, and XML. Plus you could include downloadable files that may allow browsers to understand such languages for the people who's browsers do not understand the certain languages. Everything would be alright then! Just a little pondering and thought to come to this solution :). That suggestion with PHP and all was good too...

-magicyte