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

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.

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

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.