title: returning value using ajax in Rails
body: <p>I am very new to Javascript and Ruby on rails so if this is very noob question. Please understand me. I have a very basic ajax form</p>
  
  <p><strong>Ajax</strong></p>
  
  <pre><code> $.ajax({
    type: "get",
    url: "/someurl",
    data: $('somedata').serialize(),
    success: function(response){
       alert("&lt;%=@whatever_value%&gt;");
    },
    error: function(){
      alert("Hate this!!!");
    }
  });
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>def someurl
  
    @whatever_value = Whatevermodel.find(something)
    respond_with(@whatever_value)
  
  end
  </code></pre>
  
  <p>so I am basically trying to use the <code>@whatever_value</code> from the <code>someurl</code> controller and then want to use the <code>@whatever_value</code> in the <code>view</code> where the <code>ajax</code> is located. I tried <code>respond_with</code> but it doesnt really work. Is there anyway I can get the value from the controller and then use the value in the view. If any further information is required to solve the issue, I will add some more information.</p>