Viewing an older version of mapbox.js. Check out v1.4.0 for the latest.

Loading GeoJSON into Markers

Using an AJAX call and a separate data file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Loading GeoJSON into Markers</title>
  <script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
  <link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
<div id='map'></div>
<script>
var map = mapbox.map('map');
map.addLayer(mapbox.layer().id('examples.map-zr0njcqy'));

map.ui.zoomer.add();

// example.geojson is a well-formed GeoJSON document. For this
// example, the file must be on the same domain name as the map,
// or loading will not work due to cross-domain request restrictions
var markers = mapbox.markers.layer().url('../../assets/data/example.geojson');
mapbox.markers.interaction(markers);
map.addLayer(markers);

// Zoom and center the map
map.zoom(2).center({ lat: 0, lon: 0 });

// Attribute map
map.ui.attribution.add()
    .content('<a href="http://mapbox.com/about/maps">Terms &amp; Feedback</a>');
</script>
The code and documentation to mapbox.js is hosted on GitHub where you can contribute changes and improvements.