I'm trying to get the value from my input field and concatenate it in my API url to search Flickr.
However my searchvalue variable is undefined, and it is driving me nuts.
How can I pass on the data from the input field to make the searching work?
$(document).ready(function() {
$("#myInput").keypress(function(event) {
if ( event.which == 13 ) {
var searchvalue = $(this).val();
apiCall();
}
});
function apiCall(){
$.getJSON("http://www.flickr.com/services/feeds/photos_public.gne?tags='"+searchvalue+"'&format=json&jsoncallback=?", function(data) {
$.each(data.items, function(index, element){
console.log(data.items);
});
}
);}
});