'Remote form refresh the page on submit

I am trying to add some ajax and work with remote forms on my rails 7 app. I added local: false but the form still rerenders the page instead of just sending a new call in the background. I just upgraded myself to rails 7. Am I missing anything?

<%= form_with(url: search_path, method: :get, class: 'd-flex', local: false) do |form| %>

On the controller side, I added

respond_to do |format|      
   format.js
   format.html 
end


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source