latitudehopper
latitudehopper

Reputation: 775

Sails.js socket put with form data

I have a standard form. I want to use this to put the data.

io.socket.put('/user/3', data, function (data, jwres){
            //console.log(JSON.stringify(jwres));
        });

Is there a clean and sensible way to pass all the form input values into "data" without constructing the JSON manually?

Upvotes: 1

Views: 305

Answers (1)

rxjmx
rxjmx

Reputation: 2183

You can try using this module using jQuery

$('#my-form').serializeObject();

https://github.com/hongymagic/jQuery.serializeObject

You can also implement your own function which does the same, this link will show you how to do this.

http://forum.jquery.com/topic/serializeobject

Upvotes: 1

Related Questions