I grab a JSON string from an API using jQuery's dataType 'jsonp'. The operation fails because the returning obj contains strings which have ':' colons in it.
Find fiddle here: http://jsfiddle.net/ezmilhouse/vZjV4/1/
var url = 'http://api.spreadshirt.com/api/v1/shops/329852/articles?fullData=true&locale=us_US&offset=0&attributeSet=staticShop&mediaType=jsonp';
$.ajax({
cache: false,
callback: "callback",
dataType: 'jsonp',
pageCache: false,
url: url,
callbackParameter: "callback",
success: function(data, status, jqXHR) {
console.log(data);
}});
The returning obj looks like this, which is valid JSON (tested with jsonlint.com) :
{"articles": [
{
"name": "Honoring Generations of Mothers - Youth TShirt",
"description": "t-shirt for women, Brand: ALO"
}
]}
But jQuery throws a
unterminated string literal
error because it doesn't like the colon after 'Brand'
"description": "t-shirt for women, Brand: ALO" // colon causes error
Do colons need to be escaped to work with jQuery's jsonp? Any workarounds?
thx