Yeah I've been vaguely trying to use this questions example to test something out with jsfiddle. I'm looking to build a JQuery sortable widget, but first I need to find out how I can access properties in the object I'm creating - drawing up a bit of a blank at the moment after a lot of messing about with it!
$('#ParentCategoryId').change(function() {
var data =
{
"categories": {
"category1": {
"Name": "Maps",
"Id": 3,
"orderInList": 1
},
"category2": {
"Name": "Books",
"Id": 2,
"orderInList": 2
}
}
};
$.ajax({
url: 'http://jsfiddle.net/echo/jsonp/',
dataType: 'jsonp',
data: data,
success: function(data) {
show_response(data);
},
type: 'GET'
});
});
function show_response(data) {
$.each(data, function()
{
alert(/**How could I access say, category1's Name property in here?**/);
};
Edit 1
Didn't get the full Jsfiddle link sorry, saved and edited it in.
Edit 2
Used JsonLint to create valid Json. Now I can get the alert to execute, but I'm unsure how to access the properties within!
Edit 3
Updated Jsfiddle link to latest version.