$(document).ready(function(){
  submitSearch();
}); 

var submitSearch = function(){
  $("#product-search").on('submit', function(event){
    event.preventDefault();

   var request = $.ajax({
    url:"http://localhost:3000/products/results",
    data: $(this).serialize(), 
    crossDomain: true,
    type:"GET"
   });

   request.done(function(data){
    // console.log(data);
    console.log("successssssss");
    $("#product-search").hide();
    $(".search-results").text(data[0]);
   });
   request.fail(function(data){
    console.log("fail");
   });
  });
};


@@ -354,29 +354,16 @@
     
-// console.log(data);
+debugger
 %0A   
@@ -426,16 +426,177 @@
 hide();%0A
+%0A    var products = data%5B%22products%22%5D%0A    var productResults = %5B%5D;%0A%0A    for(i = 0; i %3C products.length; i++)%7B%0A      productResults.push(products%5Bi%5D.name) %0A    %7D%0A%0A
     $(%22.
@@ -616,20 +616,27 @@
 s%22).
-text(data%5B0%5D
+html(productResults
 );%0A 
@@ -641,16 +641,17 @@
 %0A   %7D);%0A
+%0A
    reque

add products names to broswer