title: Simple example of Rails 3 + UJS using Ajax to make a remote call, and rendering the resulting JSON object
body: <p>I'm trying to add some Ajax functionality in my Rails 3 app.</p>
  
  <p>Specifically, I want a button that will submit an Ajax request to call a remote function in my controller, which subsequently queries an API and returns a JSON object to the page.</p>
  
  <p>Once I receive the JSON object I want to display the contents.</p>
  
  <p>All of this with the new Rails 3 UJS approach, too. <em>Is there a good example/tutorial for this online somewhere?</em> I haven't been able to find one on google. A simple example using a button as the entry point (ie, the user clicks the button to start this process) would work, too.</p>
  
  <p><strong>Edit</strong> 
  Let me try this with a different approach. I want to have this button query an external API, which returns JSON, and display that JSON on the page. I have no idea where to even begin. Does the button itself query the external API? Do I need to go through the controller, and have the controller query the external API, get the JSON, and give the JSON back to this page? How do I display/access the contents of this JSON? I honestly can't find a good Rails 3.x example of how to handle JSON...</p>