Passing data from HTML5 to database - javascript

I want to create an apllication similar to http://www.cambridgebrainsciences.co.uk/play/rotation-task, but I want to use an HTML5 canvas to build this application, instead of Flash.
However, how can I save data like reaction time and id of button to a MySQL database? Is this possible, or should I use only JavaScript to create this "game"?

You need to employ an application server such as php to be the middle man between the client and the database. Then you would just make ajax requests to pages served by php which would read and write the data to/from MySQL and kick it back to your app.

Related

Should I create a database with only 1 table or its preferible to use a javascript object like database?

The information that I want to save of my web page clients can be put in only 1 sql table, but maybe its better to use a javascript object like database no? I'm not sure if the javascript object will support the clients traffic in my CRUD web page. I'm using node js with express for the server :)

How can i connect JavaScript to a SQL server?

I work as an intern in a manufacturing company that designed a HTML web page run by JavaScript that is supposed to show real time statistics of the machine lines.
To do this it must connect to a SQL server in real time to obtain the data that it needs to display charts and reports.
I have good knowledge of other programming languages but I'm a rookie at JavaScript and I would like to know the safest way to do this, since the database contains sensitive data.
Can this be done?
You need some sort of middleman to connect to the database. Since you want to do this with JavaScript, I suggest you checkout NodeJS . You can then build a simple API that when consumed it will return the data required. One benefit of building an API is you will be able to consume it from the website that is already built without having to make any changes in the back end. You can simply use fetch the data from the front end using JavaScript.
Don't do this directly with Javascript in your HTML file in client-side(It is not secure).
Do this with any language that you know on the server side and read those data using ajax and display them in your HTML file.

How can I access a mongoDB database through javascript in WordPress?

I am aggregating data through different sources and compiling them into a mongoDB database on my computer.
My goal is to then have a wordpress website that then serves up some of that data to visitors through javascript code/dashboards. The MongoDB database will also be continually updated (a few times a week).
Would it be feasible/simple to connect the mongoDB database to the wordpress site, or is there a better way to structure this?
JavaScript, client side, does not directly access a server's database. You would need to use an API of some sort to call the PHP Wordpress script and refresh the page that way. Or, if it only updates a few times a week, just use the JavaScript to notify the user when to refresh the page. PHP should have no problem displaying DB results

How to integrate Node.js into a PHP Website?

Basically, I want to run my website with PHP using MySQL, and saving the data stored in an input / textarea on the database. This is pretty simple and I have no issues at doing so, but what I can't seem to figure out is how to integrate Node.js into this same website to take the user information previously entered and rendering it realtime. (Probably using Socket.io).
I believe this is a way to explain myself in a much simpler way:
Basic Website (HTML,CSS, JS) -> Processed and saved to Database with PHP -> Node.js takes this data and renders it to make realtime communication possible.

How can I use session specific data files in javascript

I am creating a web application using Ruby Sinatra. However, I think this question is more related to html/javascript.
In the front end I am using d3.js for some pages. I want to create and use data files based on user input. So for each user session I want to create a data file for that session.
I think I can create the custom html/javascript for each request.
Is there any other way to do this, such as passing the file name to the javascript?
You can use sessionStorage (some examples is here http://www.nczonline.net/blog/2009/07/21/introduction-to-sessionstorage/)

Categories

Resources