-
-
Save un33k/b00626660274074caacaedf5aa97e363 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#coverinner').on( | |
{ | |
'focus': function(event) { | |
$(this).autocomplete({ | |
minLength: 3, | |
source: function(req, res){ | |
$.ajax({ | |
url: 'https://maps.googleapis.com/maps/api/place/autocomplete/json', | |
data: { | |
input: req.term, | |
sensor: false, | |
key: 'GET YOUR API KEY AT https://code.google.com/apis/console/' | |
}, | |
success: function(data, textStatus, jqXHR){ | |
res($.map(data.predictions, function(el, k){ | |
return el.description; | |
})) | |
}, | |
error: function(jqXHR, textStatus, errorThrown){ | |
console.log(errorThrown); | |
} | |
}); | |
} | |
}); | |
}, | |
'blur': function(event) { | |
$(this).autocomplete('destroy'); | |
} | |
}, | |
'input[aria-labelledby$=location-label]' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment