Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] inline cell edit - JSON parse error

Expand Messages
  • Satyam
    If you are using Firefox with Firebug, you can start the debugger and see in the Net or Console tabs the communication in between your browser and the server.
    Message 1 of 5 , Sep 2 7:19 AM
    • 0 Attachment
      If you are using Firefox with Firebug, you can start the debugger and
      see in the Net or Console tabs the communication in between your browser
      and the server. There are similar facilities in other browsers or you
      can use external tools like Fiddler or Wireshark that lets you see what
      comes and goes. In the more basic, you can just do an
      alert(o.responseText) and see what is being received. Most of the time,
      such an error message is because the URL you are sending is not what you
      planned, either because some extra characters or some missing ones, or
      the server got confused and, in all these cases, the server might be
      sending you a very user-friendly descriptive message nicely formatted in
      HTML for you to see, the problem being that the JSON parser does not
      understand nicely formatted HTML. I would try the alert(o.responseText)
      trick first and if that doesn't bring any obvious reason, you can go for
      the other options.

      Satyam


      paolleta escribió:
      > Hi all,
      > I am trying to implement the Inline cell editing based on Satyam's example found here http://yuiblog.com/blog/2008/10/27/datatable-260-part-two/. Unfortunately I keep getting a JSON parse error right here var r = YAHOO.lang.JSON.parse(o.responseText);
      > I tried to alert the (o.responseText) and it returns the whole HTML code
      > for the page. Is there any way to navigate the o.responseText in order to get only the string I need?
      > thanx
      >
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.409 / Virus Database: 270.13.75/2340 - Release Date: 09/01/09 20:03:00
      >
      >
    • juliebonniedaisy
      o.responseText will return whatever your ajax page is told to return, if you just want a JSON string the just return only that such as my echo does at the
      Message 2 of 5 , Sep 2 7:26 AM
      • 0 Attachment
        o.responseText will return whatever your ajax page is told to return, if you just want a JSON string the just return only that such as my echo does at the bottom:

        $SQL="SELECT UserID, CONCAT(LastName, ',', Firstname) AS FullName FROM Users ORDER BY LastName, FirstName";

        // prepare statement
        if ($stmt = $oConn->prepare($SQL)) {
        $stmt->execute() or die ("Could not execute statement"); // execute prepared statement

        $stmt->bind_result($UserID, $FullName);

        $arr = array();
        while ($r = $stmt->fetch()) {
        $arr[] = array("label" => $FullName);
        // $arr[] = array("value" => $UserID, "label" => $FullName);
        }
        echo "{ \"dropdownOptions\": " . json_encode($arr) . "}";
        $stmt->close(); // close statement
        }
      • paolleta
        Hi again and thanks a lot for the quick reply. Sorry for the trivial question but what would a proper alert(o.responseText) for the inline cell edit example
        Message 3 of 5 , Sep 2 9:49 AM
        • 0 Attachment
          Hi again and thanks a lot for the quick reply.
          Sorry for the trivial question but what would a proper alert(o.responseText) for the inline cell edit example look like?
          I am pretty sure I could get going much faster if you show me an example of a proper output. I know I am such a newbie...

          Thanks



          --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          > If you are using Firefox with Firebug, you can start the debugger and
          > see in the Net or Console tabs the communication in between your browser
          > and the server. There are similar facilities in other browsers or you
          > can use external tools like Fiddler or Wireshark that lets you see what
          > comes and goes. In the more basic, you can just do an
          > alert(o.responseText) and see what is being received. Most of the time,
          > such an error message is because the URL you are sending is not what you
          > planned, either because some extra characters or some missing ones, or
          > the server got confused and, in all these cases, the server might be
          > sending you a very user-friendly descriptive message nicely formatted in
          > HTML for you to see, the problem being that the JSON parser does not
          > understand nicely formatted HTML. I would try the alert(o.responseText)
          > trick first and if that doesn't bring any obvious reason, you can go for
          > the other options.
          >
          > Satyam
          >
          >
          > paolleta escribió:
          > > Hi all,
          > > I am trying to implement the Inline cell editing based on Satyam's example found here http://yuiblog.com/blog/2008/10/27/datatable-260-part-two/. Unfortunately I keep getting a JSON parse error right here var r = YAHOO.lang.JSON.parse(o.responseText);
          > > I tried to alert the (o.responseText) and it returns the whole HTML code
          > > for the page. Is there any way to navigate the o.responseText in order to get only the string I need?
          > > thanx
          > >
          > >
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > > ------------------------------------------------------------------------
          > >
          > >
          > > No virus found in this incoming message.
          > > Checked by AVG - www.avg.com
          > > Version: 8.5.409 / Virus Database: 270.13.75/2340 - Release Date: 09/01/09 20:03:00
          > >
          > >
          >
        • Satyam
          You would put that right before the line giving you the error so you can see what might have caused it. alert(o.responseText); var r =
          Message 4 of 5 , Sep 2 2:02 PM
          • 0 Attachment
            You would put that right before the line giving you the error so you can
            see what might have caused it.

            alert(o.responseText);
            var r = YAHOO.lang.JSON.parse(o.responseText);



            paolleta escribió:
            > Hi again and thanks a lot for the quick reply.
            > Sorry for the trivial question but what would a proper alert(o.responseText) for the inline cell edit example look like?
            > I am pretty sure I could get going much faster if you show me an example of a proper output. I know I am such a newbie...
            >
            > Thanks
            >
            >
            >
            > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
            >
            >> If you are using Firefox with Firebug, you can start the debugger and
            >> see in the Net or Console tabs the communication in between your browser
            >> and the server. There are similar facilities in other browsers or you
            >> can use external tools like Fiddler or Wireshark that lets you see what
            >> comes and goes. In the more basic, you can just do an
            >> alert(o.responseText) and see what is being received. Most of the time,
            >> such an error message is because the URL you are sending is not what you
            >> planned, either because some extra characters or some missing ones, or
            >> the server got confused and, in all these cases, the server might be
            >> sending you a very user-friendly descriptive message nicely formatted in
            >> HTML for you to see, the problem being that the JSON parser does not
            >> understand nicely formatted HTML. I would try the alert(o.responseText)
            >> trick first and if that doesn't bring any obvious reason, you can go for
            >> the other options.
            >>
            >> Satyam
            >>
            >>
            >> paolleta escribió:
            >>
            >>> Hi all,
            >>> I am trying to implement the Inline cell editing based on Satyam's example found here http://yuiblog.com/blog/2008/10/27/datatable-260-part-two/. Unfortunately I keep getting a JSON parse error right here var r = YAHOO.lang.JSON.parse(o.responseText);
            >>> I tried to alert the (o.responseText) and it returns the whole HTML code
            >>> for the page. Is there any way to navigate the o.responseText in order to get only the string I need?
            >>> thanx
            >>>
            >>>
            >>>
            >>>
            >>> ------------------------------------
            >>>
            >>> Yahoo! Groups Links
            >>>
            >>>
            >>>
            >>> ------------------------------------------------------------------------
            >>>
            >>>
            >>> No virus found in this incoming message.
            >>> Checked by AVG - www.avg.com
            >>> Version: 8.5.409 / Virus Database: 270.13.75/2340 - Release Date: 09/01/09 20:03:00
            >>>
            >>>
            >>>
            >
            >
            >
            >
            > ------------------------------------
            >
            > Yahoo! Groups Links
            >
            >
            >
            > ------------------------------------------------------------------------
            >
            >
            > No virus found in this incoming message.
            > Checked by AVG - www.avg.com
            > Version: 8.5.409 / Virus Database: 270.13.75/2341 - Release Date: 09/02/09 05:50:00
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.