title: AJAX GET fetching HTML of the page, and not the data - Ruby on Rails
body: <p>I have to populate the checkboxes on a page from the database. I am using an AJAX get method for fetching the record ID and it's corresponding right in a hash, </p>
  
  <p>CoffeeScript:</p>
  
  <pre><code>$ -&gt;
  $(document).ready -&gt;
   $.get('/server_management/getpair/').success (data) -&gt;
     alert(data.toString()) # Shows nothing
     console.log(data) # Shows the HTML of the entire page
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> def getpair
  
   pair = UserServer.getpair
   render :nothing =&gt; true
  
   end
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code> def self.getpair
  
   UserServer.find_each do |us|
      if us.user_id == @uid # @uid is getting its value in another UserServer method
         pair[us.server_id] = us.right
      end
   end
   gair = pair # Just for the sake of 'last-assignment-is-a-return-in-ruby' thingy
  
   end
  </code></pre>
  
  <p>Now the problem is that the AJAX get is showing "Status Code:304 Not Modified" and the console.log(data) shows the HTML of the page.</p>
  
  <p>I will be grateful for any help.</p>