开发者

Problem with JSon

I'm not getting concatenate the variables to make an acceptable result for开发者_StackOverflow社区 json, can someone give me an idea of ​​the correct form of concatenation?

I'm doing this:

date: '{"sUserName": "' + nomeUser'","' + + '" sPassword ":"' + password +'"}',

and the result is as follows:

{"sUserName": "a", "" sPassword ":" a "}


Replace:

'{"sUserName": "' + nomeUser'","' + + '" sPassword ":"' + password +'"}'

with

'{"sUserName": "' + nomeUser + '","' + 'sPassword":"' + password +'"}'

You have an extra '+' and an extra ". And here's a simple way to avoid this in the future:

var obj = {}; obj.sPassword = 'test'; obj.sUserName = 'p'; JSON.stringify(obj)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜