im learning RoR atm and im trying to code a calculator webapp.
The thing is: I want that the operations are gettin calculated in realtime.
So if i type in 2+2 the calc says 4 without that i pressed some “CALC NOW” button.
Can someone give me some hints how i could to that? Do i need to learn AJAX for that?
You can do the calculations on the client side using JavaScript only. Or you can use JavaScript-driven automatic form submit or AJAX to send the input to the server and calculate with Ruby on Rails.
To calculate on the server side:
routes:
CalculatorsController
app/views/calculators/create.js.erb
app/views/calculators/index.html.erb
now go to
/calculatorsand enjoy