Using Rails you can sometimes face some tricky situations. For example, the normal flow of visiting a website is that you load a page and if you want to see new information you have to either reload the page to update it or click a link to visit a different page. But what if you don’t want this page to reload? This is where AJAX comes in. In this article, we would tell you about using AJAX with Rails.
If you want to update only part of your page with the data you get from AJAX, you have mostly two options.
If you want to submit a form using AJAX you can do this without having to write an AJAX request. Rails can handle it for you. Use the
remote: true option with
Remember that AJAX isn’t required to make your regular (non-JS framework) Rails app work, but it’s something that is helpful to have in your toolbox. Find more examples here.
And we can recommend you the article about StringScanner Ruby gem that provides lexical scanning operations on a string. It can help you win your daily fight with matching operations and moving a scan pointer.