Forum Moderators: open

Message Too Old, No Replies

Get/Post Javascript?

         

Lee chun son

9:02 am on Sep 27, 2018 (gmt 0)

5+ Year Member



I have been coding html, js and css for a while but it's all been pretty much client side. I now need to know how to 'write' to a network location.

This is going to be a simple 10 question quiz. What I need after they're done with the quiz:
1) A score only posted back to the user (I can get this done)
2) The answers back to a network location - webpage - ?

I've read a lot and I can't do php, Ajax. So I don't think I can create a file. But what I was thinking was that I could 'post' the information to a webpage.

So my questions are:
1) Is that possible?
2) I understand the form submit code but how to I 'pick' up the transmitted info and load it onto a page?
3) Since there will be around 30 people taking this 'test' at the same time can I post ALL their results to the same page or will I have to have different pages for each user?
4) Is this the best solution or is there and easier way?

I don't think I can use any true 'server side' programming like PhP etc. due to some 'security' issues.

THANK
Cristiano

justpassing

9:07 am on Sep 27, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



You just need to have the whole quiz running client side, and just run it within the page (no get or post), when the quiz is answered, you call a javascript function which is checking the answers and out putting the results / answers in the current page. No need to get / post submit to the server in that case.

I don't think I can use any true 'server side' programming like PhP etc. due to some 'security' issues.

hum

robzilla

9:19 am on Sep 27, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you want to combine people's results and display them in something like a public list of high-scores, you'll need to store those scores somewhere, and that somewhere is going to have to be on the server-side. If you could change a web page from the client-side, that would be a much bigger security issue.

NickMNS

1:11 pm on Sep 27, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've read a lot and I can't do php, Ajax.

I'm not sure what you mean with this statement. Is this a coding skills issue?

2) The answers back to a network location - webpage - ?

I suspect that you do not clearly understand what is required and how to make that work. A "network location" is a "url" that is the address of server where the data that you sent will be processed in some way. Typically the server will send a response back to let the sender know it has done its job. It is not a webpage.

Sending something to a "network location" is pointless unless you do something with the data received, such as store it in a database, do a calculation, send it somewhere else. Until you know what you are going to do with the data you can't really do anything else.

This said, it is possible to "post" data to a "network location" without a web-server by using a service worker, this is often referred to as "serverless". But this is a complex process that requires advanced knowledge of Javascript and "XHR request" (AJAX). And as mentioned above, this is completely pointless unless you are able to process the data collected.