[英]JSON.stringify to variable
I need solution. 我需要解决方案。 Look please:
请看:
setInterval(function(){
alert(JSON.stringify(dragposition));
},1000);
It works great. 效果很好。 It shows me json code.
它显示了我的json代码。
But I need put json in variable. 但是我需要将json放在变量中。 Something like this:
像这样:
var json_text = JSON.stringify(dragposition);
setInterval(function(){
alert(json_text)
},1000);
But it's not working. 但这不起作用。 (Shows
'{{}}'
) (显示
'{{}}'
)
dragposition
is ui.position
from jQuery ui. dragposition
是ui.position
来自jQuery ui。
what about 关于什么
var json_text;
setInterval(function() {
json_text = JSON.stringify(dragposition);
alert(json_text);
}, 1000);
json_text will be accessible out of the setInterval loop json_text将可从setInterval循环中访问
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.