Wednesday, 28 August 2013

Json not able to access via dot operator

Json not able to access via dot operator

I am using a4j jsFunction to send data to server and receive Json from server
<a4j:jsFunction name="submitData"
action="#{imageRetriveBean.saveData}" data="#{responseNodesPathsBean}"
oncomplete="processData(event.data)">
<a4j:param name="param1" noEscape="true" value="myFunction()"
assignTo="#{imageRetriveBean.requestJsonMsg}" />
<a4j:param name="param2" noEscape="true" value="getFloorNo()"
assignTo="#{imageRetriveBean.floorNo}" />
</a4j:jsFunction>
In the processData function below
function processData(data)
{
console.log(data);
var dataObj = data.responseJsonMsg;
}
The console.log prints the data correctly. Following is the output.
({responseJsonMsg:"{//my data}"})
but I am not able to access the data using the data.responseJsonMsg
The console gives the error
TypeError: data is undefined
Please help me know where I could be wrong. Thanks

No comments:

Post a Comment