Javascript API - callback not being called because of empty json response


(Steve Brown) #1

Hi all,


have just started getting into the javascript API and am finding that none of my callback functions are getting called



eg:



getMetadata(90351,function(data) { console.log("here")} );



or



setMetadata(assetId,metadataId,value,function() {alert("here") });



I know they are working because the setMetadata call is actually changing the metadata, however none of the callback functions are firing.



It seems that a syntax error is occuring at line 75 in the below code (from the javaascript api asset - not my code ) and when I set a breakpoint here and have a look it seems that json is an empty string.



Any ideas on what could be wrong?



Thanks



Steve.



function jsonToObj(json)

72{

73 // Make the conversion

74 // Don't worry, even the creator of JSON says eval is ok here

75 var jsonObj = eval('(' + json + ')');

76

77 return jsonObj;

78

79}//end jsonToObj


(Nic Hubbard) #2

[quote]Support for the new JS API Asset in the Web Services Package requires the Services_JSON PEAR package, version 1.0.0. Alternatively the PHP version specified for this release can be used.[/quote]

Do either of these apply in your case?

(Steve Brown) #3

Thanks Nic, yes you were right. Working now.