Have you hidden your 'getJson' function from global scope, by defining it
inside of another function?

--
David Winslow
OpenGeo - http://opengeo.org/


On Sat, Jan 19, 2013 at 1:27 PM, Michael Savarese <[email protected]>wrote:

> Using GeoServer(2.13) and Leaflet with jQuery, I've tried countless
> variations for the following code snippet:
>
> function getJson(data) {
> console.log(data)
>  geojsonLayer.addData(data);
> }
>
>
> $.ajax({
>  url : "http://geoserver.capecodgis.com/geoserver/capecodgis/ows?
>  
> service=WFS&version=1.0.0&request=GetFeature&typeName=capecodgis:tracts_2010_4326&maxFeatures=2&outputFormat=json&format_options=callback:getJson",
>  dataType : 'jsonp'
> //jsonp: false,
> //jsonp : "format_options",
>                 //jsonpCallback : "callback:loadThis",
>                //type : "GET",
>
> });
>
> here is the error I recieve: ReferenceError: getJson is not defined
>
> http://geoserver.capecodgis.com/geoserver/capecodgis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=capecodgis:tracts_2010_4326&maxFeatures=2&outputFormat=json&format_options=callback:getJson&callback=jQuery183028543826857255483_1358619277402&_=1358619277746
> Line 1
>
> but it seems unable to send the data to the function getJson(). The json I
> request shows up when viewed in Firebug. I've read the GeoServer docs and a
> few examples on gis.stackexchange but I just can't get any further. Any
> help would be greatly appreciated.  Here is the live site I'm working with
> http://leaflettest.capecodgis.com/
>
> thanks in advance,
>
> Michael
>
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to