JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
JavaScript
$(document).ready(function(){
var colors = {colors : ['red','yellow','blue']};
var colorjson = JSON.stringify(colors);
alert(colorjson);
/*
$.ajax({
type:'POST',
url: '/echo/json/',
cache: false,
success: function(d) { alert(d.colors[0]);},
error: function() { alert('boo');},
data: { json : colorjson }
});
*/
$.post('/echo/json/', { json: colorjson }, function(d) { alert(d.colors[0,2]); });
//you would do the same thing with $.getJSON(...), if it were supported by jsFiddle....
//$.getJSON('/echo/json/', { json: colorjson }, function(d) { alert(d.colors[0]); });
});