I don't know JSON.
It will be
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
instead of
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"><script/>
Code:
<html>
<body>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
<script type="text/javascript">
var obj={x:1, y:2};
var json_data = JSON.stringify(obj);
document.write('xx' + json_data + '<br/>'); // xx{"x":1,"y":2}
</script>
</body>
</html>
Code:
<html>
<body>
<script type="text/javascript">
var obj={x:1, y:2};
var json_data = JSON.stringify(obj);
document.write('xx' + json_data + '<br/>'); // xx{"x":1,"y":2}
</script>
</body>
</html>
The output of the codes above will be:
xx{"x":1,"y":2}
in Firefox 4.0b9
Last edited by Ayşe; 01-09-2012 at 02:51 PM.
The Time Through Ages
In the Name of Allah, Most Gracious, Most Merciful
1. By the Time,
2. Verily Man is in loss,
3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
Bookmarks