We are using the Javascript API to set a metadata field.
After setting the API key we have this fairly straight forward bit of code:
$(document).ready(function(){
var asset_id='6363';
var field_id='7527';
var fvalue='%form_submission_id%';
setMetadata(asset_id,field_id,fvalue,printResponse);Whch does what is wanted, but it throws a javascript error:
Error: syntax error
Source File: .../_web_services/javascriptapi.js
Line: 75, Column: 1
Source Code:
()The error message is actually pointing to the last line here:
function jsonToObj(json)
{
// Make the conversion
// Don't worry, even the creator of JSON says eval is ok here
var jsonObj = eval('(' + json + ')');Using firebug, we've determined that function jsonToOBJ is being passed an empty string,
but I would have thought that this line in function success:
if (ajaxRequest.responseText !== '' || ajaxRequest.responseText !== 'undefined' || ajaxRequest.responseText !== null) {
var response = jsonToObj(ajaxRequest.responseText);Would have prevented function jsonToObj from being called.
Is this a bug?
Can anyone suggest a workaround... please?
regards
Polonius