I want to request GeoServer using AJAX. Since those request have long query strings I want to modify them comfortably using a js object like this:
defaultParameters = {
service: 'WFS',
version: '1.0.0',
request: 'GetFeature',
typeName: 'nurc:roadAnalytics1',
maxFeatures: 50,
outputFormat: 'text/javascript'
};
How can I transform this object into a query string like this one:
http://someurl?service=WFS&version=1.0.0&request=GetFeature&typeName=nurc:roadAnalytics1&maxFeatures=50&outputFormat=text%2Fjavascript
So basically I am asking for the opposite way as this question
asked Feb 13, 2016 at 22:01
1 Answer 1
Try this:
jQuery.param( defaultParameters );
This returns service=WFS&version=...
so you need to append this after the ?
in the URL.
answered Feb 13, 2016 at 22:03
Sign up to request clarification or add additional context in comments.
1 Comment
nik
Great, hoped that there will be such an easy solution. Works perfectly!
Explore related questions
See similar questions with these tags.
lang-js