title: good way to insert into observable array in knockout using jQuery
body: <p>I am trying to load in my JSON file and then make an insert for each item.</p>
  
  <p>so I have this code </p>
  
  <pre><code>function ProductType(id, name) {
  var self = this;
  
  self.id = id;
  self.name = name;
  }
  
  
  function ProductsViewModel() {
      var self = this;
      var jqxhr = $.getJSON("data/product.json").success(function(data, status, xhr) { 
            self.products = ko.observableArray([    
        $.each(data.data.productTypeList, function(i,item){
            new ProductType(i, item.longName);
      })
  ]);               
        })
       .error(function() { alert("error"); })
       .complete(function() {
          console.log("fetch complete + " + this);
       });
  
  }
  </code></pre>
  
  <p>I wondered how best practice to insert into an observable array from an each function</p>
  
  <p>at the current time I get this error</p>
  
  <p>Error: 500 Error get /knockoutJQMProducts/#products Unable to parse bindings.
  Message: ReferenceError: products is not defined;
  Bindings value: foreach: products</p>
  
  <p>but if i console.log(i) within the each statement it returns the results.</p>
  
  <p>Thanks</p>