title: Set ruby instance variable inside javascript function
body: <p>I am trying to set a ruby instance variable's value to the latitude and longitude values.
  How would you set the value of an instance variable inside a javascript function?</p>
  
  <p>Something like this?</p>
  
  <pre><code>&lt;script&gt;
      if (geoPosition.init()){  geoPosition.getCurrentPosition(geoSuccess, geoError);  }
  
      function geoSuccess(p) { 
          &lt;% @lat_lng = p.coords.latidude + "," + p.coords.longitude %&gt; 
      }
  
      function geoError(){ alert("No Location: Won't be able to use Maps functionality"); }
  &lt;/script&gt;
  </code></pre>
  
  <p>Something is telling me I need json.</p>