2 Replies Latest reply on Oct 10, 2007 6:36 PM by Sunny Anand

    jsFunction "data" syntax error issue

    Sunny Anand Newbie

      I am using the following tags to get server data:

      <a4j:form ajaxSubmit="true">
      <a4j:jsFunction name="getAllProcesses" data="#{bean.blah}"
      oncomplete="initAllProcs(data.foo)" />

      The server side code is as follows:

      public JSONObject getAllProcesses() {
      JSONObject x = new JSONObject();
      return x;

      I get the following AJAX Response:
      <![CDATA[ {'foo':'bar'} ]]>initAllProcs(data)

      When getJSON is called I see the following error in the log:
      debug[10:18:37,523]: call getElementById for id= org.ajax4jsf.oncomplete
      debug[10:18:37,523]: Call request oncomplete function after processing updates
      debug[10:18:37,539]: call getElementById for id= _ajax:data
      error[10:18:37,539]: Error on parsing JSON data syntax error

      I believe that getJSON calls window.eval on (<![CDATA[ {'foo':'bar'} ]]>) which generates a syntax error