Over a million developers have joined DZone.

using json api url to read weather api

·

 this snippet shows how to get json api from online weather.com api

class WeatherController < ApplicationController
  
  def home
    @report = nil
  end
  
  def find
    @city = params[:q]
   @weather = WeatherModel.get("http://api.worldweatheronline.com/free/v1/weather.ashx?q=#{@city}&format=json&num_of_days=1&key=KEY")
  
  respond_to do |format|
    format.js { render 'find.js.erb'}
  end
   
   
  end
  
  
end
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}