0

So I was learning JavaScript/jQuery and building a website as I go along. Now I need to have a database, and my friend recomended learning Ruby and using it to handle data. From this question: JavaScript Execute Ruby Script It shows how I could execute the Ruby script, but I was wondering if it is possible to send data to that script so it can push it to a MySQL database?

Basically the user would submit a string, and all the stuff is dynamically generated by JS, so I want to send that string to the SQL db as soon as the user submits it. If anyone can point me in the right direction in terms of readings. I don't have much knowledge/experience in Ruby so anything that redirects me to something useful for this particular task would be great. Thanks!

1 Answer 1

1

The question you referred to is probably not what you want. That will only work if the server is on the same machine as your browser and if that machine runs Windows.

For a website, that everybody can visit you need to have a server that runs some software - in your case written in ruby - and that is sent requests by the browser - in your case through your JavaScript program.

To do that you need to send an XMLHttpRequest. For jQuery you can read about this in the docs or in a tutorial. This way you get your browser to talk to the server.

For the server to listen and respond you should use some framework like Ruby on Rails or (not Ruby but Python) Django.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.