I am having issues trying to set up a geocoder/locator on my server. I keep getting an error SyntaxError {log: undefined, stack: (...), message: "Unexpected token <"}, but I can't seem to figure out why. I tried exploring the error message, but I don't get much good information out of it.

I have tried using ESRI's geocoder widget then created my own set up using the locator service. I have checked my address string, and I believe it should be passing correctly over to the server.

If I am understanding the error message right, it is saying there is a token "<" somewhere that shouldn't be there, but I cannot find it.

Other info... I am running version 9.3.1 for my server, using the JavaScript API 3.8 that ESRI hosts, and created an address locator on my server using street centerlines for the area I am mapping.

Has anyone run into this issue before or have suggestions for me? Right now, I am just trying to center the map on the location. Once I get that done, I can worry about all the other stuff.

My code for the locator is below.Here is my development site.

locator = new Locator(singleFieldGeocodeURL);
//add handler for completion
locator.on("address-to-locations-complete", showResults);

//trying to find the error
locator.on("error", function (error) {
    errorObject = error;
    console.log("error" + error);


//add handler for button click
on(dom.byId('locate'), 'click', function () {


    var address = {
        "SingleLine": dom.byId('address').value

    locator.outSpatialReference = map.spatialReference;

    var options = {
        address: { street: address },
        outFields: ["Loc_name"]



function showResults(evt) {
    console.log("in show results");
    var candidate;
    var symbol = new SimpleMarkerSymbol();
    symbol.setColor(new Color([153, 0, 51, 0.75]));

    var geom;
    arrayUtils.event(evt.addresses, function (candidate) {
        if (candidate.score > 80) {
            var attributes = {
                address: candidate.address,
                score: candidate.score,
                locatorName: candidate.attributes.Loc_name
            geom = candidate.location;
            var graphic = new Graphic(geom, symbol, attributes, null);

            return false;


    if (geom !== undefined) {
        map.centerAndZoom(geom, 12);


1 Answer 1


you are providing an invalid url to your locator service in your code.


//should be


just as an aside, it would have been substantially less painful to help you debug the error related to your locator if you had provided more than a mysterious variable name in your code snippet or a link to an app without code that had already been minified.

  • Thanks! I do apologize for leaving my code minified. I totally forgot I had it set up to minify when I was saving it. I didn't even think it was related to my URL, but it is the simple mistakes that get me.
    – Branco
    Commented Jul 14, 2014 at 12:03
  • no worries at all Branco. glad to help :) Commented Jul 14, 2014 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.