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

asked Feb 13, 2016 at 22:01

1 Answer 1

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

Great, hoped that there will be such an easy solution. Works perfectly!

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.