I'm trying to return jsonp as in callbackname(data.strified)
callback( null,
( !!event.cb && event.cb.length > 0 )
? event.cb.replace( /[^a-z0-9_]/i, '' ) + '(' + JSON.stringify( data ) + ')'
: data
);
My quick and dirty way now returns the data and if ?cb=test is given it returns:
"test({\"valid\":false,\"data\":false})"
Is there anyway to get rid of the quotes and escape characters? The API should work with and without callback set.