I'm making a request to a JSON page using jQuery's $.getJSON
method, and from the returned JSON i'm creating some HTML and putting it on to the page.
The problems appears when I have a nested JSON object, i'll show you an example later.
First off, if I make a request to my JSON page and return the following JSON, the function works just fine and i see a beautiful HTML element appear on the page:
JSON:
({
"variants": [
{
"variantId": "536",
"title": "Party Like a Rock Star for Two at the Metropolitan hotel, London ",
"price": "£299.00"
}
]
})
This works fine, no errors.
However, as soon as i return the JSON below, the function does not work.
({
"variants": [
{
"variantId": "536",
"title": "Party Like a Rock Star for Two at the Metropolitan hotel, London ",
"price": "£299.00",
"blogs": [
{
"title": "Another test",
"author": "Sean",
},
{
"title": "This is a test",
"author": "Sean",
}
]
}
]
})
As you can see, there are no characters in it that would cause it too break. I've also tried renaming the fields, just by chance that "blogs", "title", or "author" were reserved words in JS (as i thought, no difference!)
To make sure it was not my way of processing the data that was causing a problem, i stuck an alert('Got here.'); as the first piece of code (see below) in my $.getJSON function, and that doesn't fire so I know it's not what i'm doing with the data that is causing an error.
$.getJSON('/ajax/cover_flow_detail.ashx?experienceId=' + arguments[0], function(d) {
alert('Got here'); // doesn't fire ?
// omitted for brevity.
}
Even weirder - this is only happening in IE6. IE7 & FF are fine.
Any push in the right direction would be appreciated, i'm completely stumped!
Cheers, Sean