You forgot an opening bracket ({
) after your else
:
} else {
$("#map").html(mapname);
}
I would strongly recommend using a linting tool such as eslint to help track down syntax (and other) errors like this…makes it much easier to track bugs like these down.
1
solved Javascript SyntaxError: expected expression, got ‘}’ [closed]