Recipe - Food - Nutrition

फ्रीमियम
Verified
द्वारा David | अपडेट किया गया 23 days ago | Food
लोकप्रियता

9.9 / 10

लेटेंसी

518ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

How to input array as parameters for complex search?

Rapid account: Parynaz
parynaz
7 years ago

It works fine when I do the following with just a query and an array named selected = [“Vegetarian”] for complex search:

return $http.get("https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/searchComplex?addRecipeInformation=false", 
							{params: {'query': query, 'diet' : selected }}).then(
			function(payload) {
				var recipes = payload.data;
				return recipes;
			}

However, when I try to pass in more than one selected diet (for example when selected = [“Vegetarian”, “Vegan”]) the results don’t change and I can tell from the results that they are not vegan. I understand that the URL has to become …&diet=vegetarian%2C+vegan … but I’m not sure how to turn my array of string into that. Thanks!

Rapid account: Spoonacular
spoonacular Commented 7 years ago

Hi, this is how you get the array to string: http://www.w3schools.com/jsref/jsref_tostring_array.asp

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें