title: Best way to return a string from a controller to ajax call
body: <p>I want to create an action that returns me a single string value:</p>
  
  <pre><code>def delay_calulation()
    dr = Dr.find(params[:id])
    delay = dr.calc()
  
    respond_to do |format|
      format.json { render json: {"value" =&gt; delay}}
    end
  end
  </code></pre>
  
  <p>but I a "fail" in my ajax call:</p>
  
  <pre><code>$("#btn_delay").on("click", function () {
      $.ajax({
        type: "GET",
        dataType: "script",
        url: "/drs/delay_calulation/1"
      })
      .done(function(response){
          console.log(response);
      })
      .fail(function(response){
          console.log(response);
      });
  
    });
  </code></pre>
  
  <p>How can I get a single string, or something like that.</p>