Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any idea why the function loadThis() comes back as undefined? I've tried adding jsonp: false which doesn't help either. The json object is returned properly, I can view it in FireBug, but I can't get it to the callback function. Hope it's something simple I've missed,

var geojsonLayer = new L.GeoJSON();

function loadThis(data) {

    url : "",
    dataType : 'jsonp'

share|improve this question
This is the site I'm testing with: – geomajor56 Jan 19 '13 at 15:59
up vote 7 down vote accepted

Things to change to make this work:

  • use jsonpCallback in your $.ajax call to provide the name of callback function
  • use success to specify a function to handle your data once it is retrieved
  • note that the callback name and the name of the function used to process your data need to be different

Here's working code:

var geojsonLayer = new L.GeoJSON();

function handleJson(data) {

  url : "",
  dataType : 'jsonp',
  jsonpCallback: 'getJson',
  success: handleJson

share|improve this answer
Wow, nice. Thank you so much. I've been agonizing over this for 2 days. – geomajor56 Jan 19 '13 at 21:49
Glad I could help! – Derek Swingley Jan 20 '13 at 1:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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