2

I'm trying FastBoot in which I don't have access to jquery. Previously I was using jquery's param function:

Ember.$.param(urlData);

to serialize an object into a url for an AJAX request (I'm not using ember-data). I am pretty sure ember has something built-in to do this, but I can't find it! ember mega newb here. Thanks!

tarponjargon
  • 1,002
  • 10
  • 28

2 Answers2

2

Use this as a substitute. https://github.com/knowledgecode/jquery-param

You can load it via Bower and app.import or via npm and ember-browserify.

Andrey Mikhaylov - lolmaus
  • 23,107
  • 6
  • 84
  • 133
0

I think the accepted answer is probably safer, but this also seems to work:

serializeToUrl(obj) {
    return Object.keys(obj).map(function(key) {
        return key + '=' + encodeURIComponent(obj[key]);
    }).join('&');
}
tarponjargon
  • 1,002
  • 10
  • 28