Use multiple URLs with $.getJSON

jquery, json, variables

Solution

You'll need two calls, but you can use `$.when` to tie them to the same `done()` handler :

var url = 'http://api.spitcast.com/api/spot/forecast/1/';
var url_wind = 'http://api.spitcast.com/api/county/wind/orange-county/';

$.when(
    $.getJSON(url),
    $.getJSON(url_wind)
).done(function(result1, result2) {

});

Problem

I have a few lines of code: ``` var url = 'http://api.spitcast.com/api/spot/forecast/1/'; var url_wind = 'http://api.spitcast.com/api/county/wind/orange-county/'; $.getJSON(url, function (data) { etc... ``` How would I pull both of these URLs into my $.getJSON command? I thought it would be as simple as: ``` $.getJSON(url, url_wind, function (data) { ``` I have also tried assigning these two URLs to the same variable as such: ``` var url = ['http://api.spitcast.com/api/spot/forecast/1/','http://api.spitcast.com/api/county/wind/orange-county/']; ``` Unfortunately I'm having no luck pulling the info from the second URL. Could anyone please help me out? Thanks.

Original source