Search code examples
javascriptruby-on-railsajaxrails-activejobsidekick

What is the difference between Ajax and Sidekick (Active Job) in rails?


I want to know the difference between Ajax and Sidekick (Active job). These both look same background process system.


Solution

  • The have almost nothing in common beyond being examples of asyncrony.

    AJAX is an ancient term from the dark days of the browsers wars (early 2000's) that stands for Asyncronous Javascript and XML (which was thought would become the defacto interchange format for the web back then) and currently is used to refer to the XMLHttpRequest api provided by browsers.

    Asyncronous meaning that you can send requests from the client to the server without reloading the page.

    Sidekick is a Ruby gem for queing and running background tasks on the server which lets you perform jobs without making the web thread (and the user) wait for it to complete before sending a response.

    The client-side equivilent is actually more like the Web Workers api which allows you to run scripts in the background on a browser.