jqGrid from USGS geojson data

前端 未结 1 1627
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 00:46

I\'m trying to read and post in a jqGrid a set of earthquakes GeoJSON data extracted from USGS repository. The request is accepted, but displays \"Uncaught SyntaxError: Unex

相关标签:
1条回答
  • 2020-12-12 01:29

    I looked in the documentation of geojson and I think I found the reason of the problem. It seems that GeoJSON(P) uses eqfeed_callback as callback name (see here). So I fixed some options of jqGrid which you used to the following:

    url: 'http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week',
    datatype: 'jsonp',
    postData: '',
    ajaxGridOptions: { jsonp: false, jsonpCallback: 'eqfeed_callback', cache: true},
    

    The modified demo works now and display the results like below

    enter image description here

    UPDATE: The modified demo uses new URLs of GeoJSON and new version (4.14.1) of free jqGrid.

    0 讨论(0)
提交回复
热议问题