Code moved to the right place, building URL with encodeURI. + Reset on empty inputfield.