0

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

Community
  • 1
  • 1
nik
  • 2,114
  • 3
  • 22
  • 43

1 Answers1

1

Try this:

jQuery.param( defaultParameters );

This returns service=WFS&version=... so you need to append this after the ? in the URL.

Daniel Waghorn
  • 2,997
  • 2
  • 20
  • 33