title: How to call a javascript variable inside Rails ERB tag
body: <p>I am getting the Job search results from my Rails action by using Sunspot solr as JSON, and i m creating the result view  in client side by parsing the JSON data &amp; creating HTML elements using Javascript.But from the response JSON we cant get the Job Association objects, So by using company_id field from the response JSON , am trying to access the company from the javascript itself with help of embedded ruby tag. </p>
  
  <pre><code>  function submitForm() {
     var valuesToSubmit = $('#FRM_JOB_SEARCH').serialize();
      jQuery.ajax({
      type: "POST",
      url: $('#FRM_JOB_SEARCH').attr('action'),
      data :valuesToSubmit,
      success : function(json){
        var data = JSON.parse(json);
            $.each(data, function(key, val) {
                            create_blocks(key , val);
          });
      } ,
      dataype : 'json' ,
      remote : true });
  
      }
  
    function create_blocks(key , value) {
         var feeds = eval(value)
            var company_id = feeds["company_id"];
            var company_name = '&lt;%= Company.find_by_id('company_id').name %&gt;';
            console.log(company_name);
     }
  </code></pre>
  
  <p>But this variable is not accessible inside ERB tag.How can we access a javascript variable inside RAILS erb tag.</p>