Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How can I serialize an object without using the "$ .param" jquery?

I want the object below:

var user = {   username: 'ronald.araujo',   password: '123456', };

Has the following output:

username=ronald.araujo&password=123456

Any suggestions? Remembering that I would do this using Angularjs or pure Javascript.

EDIT: I am using the verb "save" ($resource) the angularjs. How could I set the header "application / x-www-form-urlencoded" and serialize?

share|improve this question
    
Do you mean serialize it to application/x-www-form-urlencoded format? There's a simple lib available here - github.com/iambumblehead/form-urlencoded –  Phil 57 mins ago
    
possible duplicate of How do I POST urlencoded form data with $http in AngularJS? –  Phil 54 mins ago
    
There's no built-in tool to do that in Angular afaik. But why do you want to do that? You can send any kinf of GET request without having to manually add the datat into the URL. –  floribon 51 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.