code.
amplify.request.decoders.appEnvelope =
function ( data, status, xhr, success, error ) {
if ( data.status === "success" ) {
success( data.data );
} else if ( data.status === "fail" || data.status === "error" ) {
error( data.message, data.status );
} else {
error( data.message , "fatal" );
}
};
amplify.request.define( "account", "ajax", {
dataType: 'jsonp',
contentType: "application/jsonp; charset=utf-8",
url: url,
processData:false,
cache: "persist",
decoder: "appEnvelope"
});
amplify.request({
resourceId: "account",
success: function( data ) {
//stuff happens here
//do i need to do anything amplify specific here?
}
});