开发者

Serialization of Javascript from Server(NodeJS) to Browser

I would like to serialize an instance of JS object from the Server-side to the 开发者_如何转开发Client side (the object contains data members and functions)

I have a Javascript stack on both end, all my users use Chrome and My server side is a NodeJS impl..

how would I do it? It should be trivial as my server is a Javascript one..


You could send it as JSON string. Here's an example:

response.writeHead(200, {'Content-Type': 'application/json'});
response.write(JSON.stringify(yourObject));
response.close();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜