title: Passing json data from an api to a javascript variable
body: <p>Am a newbie in json/javascript so please bear with me. Am getting json data from an api url that loads sth like </p>
  
  <pre><code> {
  "employees": [
  { "firstName":"John" , "lastName":"Doe" }, 
  { "firstName":"Anna" , "lastName":"Smith" }, 
  { "firstName":"Peter" , "lastName":"Jones" }
  ]
  </code></pre>
  
  <p>i need it as a javascript variable on a script file</p>
  
  <pre><code>var employess={
  "employees": [
  { "firstName":"John" , "lastName":"Doe" }, 
  { "firstName":"Anna" , "lastName":"Smith" }, 
  { "firstName":"Peter" , "lastName":"Jones" }
  ]
  }
  </code></pre>
  
  <p>Ave tried</p>
  
  <pre><code>$.getJSON(myUrl",function(data){ $("#selector").data("JSONP",data); alert(data); });
  </code></pre>