Skip to content

Instantly share code, notes, and snippets.

@justinribeiro
Created November 16, 2011 01:59
Show Gist options
  • Save justinribeiro/1369024 to your computer and use it in GitHub Desktop.
Save justinribeiro/1369024 to your computer and use it in GitHub Desktop.
jQuery AJAX converter for getGooglePlus.php example JSON
$.ajax({
url: "getGooglePlus.php",
dataType: "jsong",
converters: {
"json jsong": function( msg ) {
var retData = new Array();
for (var i = 0; i < msg.items.length; i++) {
if ( msg.items[i].object.hasOwnProperty( "attachments" ) && msg.items[i].object.attachments.length >= 1)
{
for (var j = 0; j < msg.items[i].object.attachments.length; j++)
{
if (msg.items[i].object.attachments[j].objectType === "article")
{
retData.push( msg.items[i].object.attachments[j] );
}
}
}
}
return retData;
}
}
}).done(function( data ) {
$( "#GooglePlusLinks" ).html(
$( "#GooglePlusTemplate" ).render( data )
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment