Tuesday, 19 April 2016

geoserver - Uncaught SyntaxError: Unexpected token : when using ajax


I try to call json data from geoserver, but when i try to run it in chrome, it return this following error


"Uncaught SyntaxError: Unexpected token :"


This is my code,



    function initialize(){var urljson='http://localhost:1234/geoserver/Ven/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Ven:alamatpuskesmas&maxFeatures=50&outputFormat=json&format_options=callback:getJson';

$.ajax({
url :urljson,
dataType: 'jsonp',
jsonpCallback: 'getJson',
success: handleJson
});

}

function handleJson(data)
{
console.log(data);
}

i am using geoserver 2.4.2, whats wrong with my code?, when i try to paste the url in chrome/firefox, it return json. .




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...