<commit_before>$(document).ready(function(){

//application ID = c8af64b9
//application key = <KEY>


//base GET url:
//http://api.yummly.com/v1/api/recipes?_app_id=c8af64b9&_app_key=9b4d56a0e813fed791c590821441f01a&allowedIngredient[]=&allowedIngredient[]=cognac
//Some of the parameters support passing multiple values; in these cases, we follow the AJAX convention: param[]=value1&param[]=value2&...
//Don’t forget to URL-encode parameter names and values (i.e., [ and ] become %5B and %5D).
//

$('#submit').click(function(evt){
  evt.preventDefault();

//loop thru the child elements in the chosen-choices ul 
var content = $('.search-choice');
content.each(function(){
  
  var query = (encodeURI($(this).text().replace(/^\s+|\s+$/g,'')));
  console.log(query);

  var link = 'http://google.com/?q=' + query + '#q=' + query;
  console.log(link);

});
  
  recipesUrl = 'http://api.yummly.com/v1/api/recipes?_app_id=c8af64b9&_app_key=<KEY>'

  //get the text of each of those
  //do same logic from lines 30-40 in JS, adding &allowedIngredient[]= before each URI encoded ingredient

})

$('form#recipe_search').bind("ajax:success", function(event, data, status, xhr){
  console.log(data);<commit_msg>recipe search working<commit_after>$(document).ready(function(){

//application ID = c8af64b9
//application key = <KEY>


//base GET url:
//http://api.yummly.com/v1/api/recipes?_app_id=c8af64b9&_app_key=9b4d56a0e813fed791c590821441f01a&allowedIngredient[]=&allowedIngredient[]=cognac
//Some of the parameters support passing multiple values; in these cases, we follow the AJAX convention: param[]=value1&param[]=value2&...
//Don’t forget to URL-encode parameter names and values (i.e., [ and ] become %5B and %5D).
//

$('#submit').click(function(evt){
  evt.preventDefault();

//loop thru the child elements in the chosen-choices ul 
  
  var recipesUrl = 'http://api.yummly.com/v1/api/recipes?_app_id=c8af64b9&_app_key=<KEY>';

var content = $('.search-choice');
  content.each(function(){
  
  var query = (encodeURI($(this).text().replace(/^\s+|\s+$/g,'')));
  console.log(query);

  term_chunk = '&allowedIngredient[]=' + query;
  
  recipesUrl += term_chunk;
});

  recipesUrl += '&maxResult=300';
  $.ajax({
    url: recipesUrl,
    dataType: 'json',
    method: 'GET',
    success: function(data){
      console.log(data);

    for (var i = 0; i < data.matches.length ; i++) {
  
  // var spaces = data.matches[i].recipeName().replace('/%20/g','+');


if (data.matches[i].smallImageUrls == undefined){
  imgSource = '';
} else {
  imgSource = "<img src=" + data.matches[i].smallImageUrls[0] + ">";
};      

  var query = encodeURIComponent(data.matches[i].recipeName);
  var link = 'http://google.com/?q=' + query + '#q=' + query;

    $('.show-recipe').append(
     '<li>' + '<a href=' + link + '>' + data.matches[i].recipeName + '</a><br />' + imgSource + '<p>' + 'rating: ' + 
      data.matches[i].rating + '</p></li>'
      );
  };
    }
  });
}); 
  

  //get the text of each of those
  //do same logic from lines 30-40 in JS, adding &allowedIngredient[]= before each URI encoded ingredient



$('form#recipe_search').bind("ajax:success", function(event, data, status, xhr){
  console.log(data);
{'fraction_non_alphanumeric': 0.1906094527363184, 'fraction_numerical': 0.029539800995024876, 'mean_word_length': 4.090189873417722, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3606027', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1150, 'n_words': 248}