AJAX Requests - Take Home Assignment

Hi everyone! I recently did a Take Home Assignment for a company, where one of the tasks was to make AJAX requests to display results on the same page instead of page navigation. I was able to do it, but I had a question about it that I wanted to ask.

The application was in Ruby, with Frontend in JS + HAML. They had included jquery also in the application. In their task description, they said I was to alter the JS code to do the AJAX requests. But my struggle was with understanding since there are ways to do AJAX in JS, jquery, Ruby, and Ruby w/ HAML, what is the right way to go about this? My solution was just JS and nothing else. But in this case, should I have done the AJAX with jquery instead? Or does it not matter since it worked, and they told me to do it in the JS file?

I apologize in advance if the question is confusing.

2 Likes

Hi Rabab!

For take home projects, the most important thing is to follow whatever directions and constraints they give you. So if there was no requirement around how the AJAX query was to be made, then I don’t think it matters too much. Usually, if your application has any sort of JS frontend, I would recommend using JS to make any AJAX requests. jQuery is just a tool to make certain JS actions easier to do, so it’s usually not a huge deal which one you use (it’s all JS in the end).

It is possible to do AJAX requests with other languages, frameworks, and tools. So it all comes down to what the instructions say. If there is no specification it’s important to use the language you know best, and then give context into why you did the AJAX requests a certain way and how it works.

Hope this helps clarify things!

4 Likes

Okay, that makes sense. Thank you, this definitely clears it up for me! :grinning: