JSON response with object ref
Hello,
I am using jQuery 1.4 to call an ajax action that returns a JSON response with the following structure.
{
"errors": [ {
"type": xyz.AjaxActionErrorType.UKNOWN_OPERATION,
"msg": "Uknown ajax operation."
}],
"source": "xyz.web.action.util.GisAjaxAction"
}
The xyz.AjaxActionErrorType.UKNOWN_OPERATION is a JavaScript object that is defined and should be available on the page that calls the ajax action - at least I can dump the object in the console log prior to invoking $.ajax and I can thus confirm it exists.
The trouble is that $.ajax always reports a parse error and invokes the error handler function. I guess this may have something to do with the fact that jQuery 1.4 no longer uses eval to process the received JSON response (???).
Basically I want json.errors[0].type to contain the predefined xyz.AjaxActionErrorType.UKNOWN_OPERATION object which is used as an enum in the application.
Is there any way to get this to work, is it a bug, or is it just conceptually impossible?
Thank you,
Jan