Skip to content

MapQuest.js

L.mapquest.searchAhead(options, callback)

A class that acts as a simple interface to the Search Ahead API. The class provides predictive location results based on the provided input parameters.

Syntax

js
L.mapquest.key = 'KEY';

var options = {
  q: 'Denver, CO',
  collection: 'address,adminArea,airport,poi'
};

L.mapquest.searchAhead.prediction(options, searchAheadCallback);

function searchAheadCallback(error, result) {
  console.log(result);
}

Parameters

Request ParameterDescriptionRequired
options
object
An object containing options from the Search Ahead API. The q and collection fields are required.Yes
callback
Function
An error-first callback to be invoked upon completion of the search ahead prediction function call.Yes

Return Value

The Search Ahead API response will be returned.