I have a web page with a tiny space for users to submit some comments.
just one line of text and a button.
if they use it, after pressing the button I have a bit of javascript which disables the button and thanks them.
The next bit is how to send their comment to the server.
The way I have done it is the following:
in the javascript which handles the ‘submit’ I create a new javascript like this:
var script = document.createElement('script');
script.src = 'usercomment.js?'+commentValue;
document.body.appendChild(script);
I don’t have any usercomment.js script so the call fails silently.
However the advantage is that I get a call to the server which is logged and then I can read all of the comments.
I am happy with this solution but I was wondering if there is a better way to achieve the same thing. Somehow it seems quite convoluted and a bit of hack.
so my question is what’s the standard way to record something as simple as an action from the browser to the server ?
p.s.
I am not allowed to modify the server side. So I can only rely on its logs to retrieve this type of information.
p.s.
please don’t suggest an event in google analytics that would be breaching their legals.
Looks like my solution is plausible:
That is
I will accept that. If somebody has a better way please add it up and I will vote it.