<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thank you for the great <span
        id="result_box" class="short_text" lang="en"><span class="hps">explanations
          Michael and</span></span> Tim.<br>
      <br>
      Now i don't get this error but another ! I'm still don't view
      route.<br>
      <br>
      Postgis returns the geojson with quoting i think this may be the
      error.<br>
      <br>
      I'm attached a ss of firebug.<br>
      <br>
      Anybody know the problem?<br>
      <br>
      thanks <br>
      <br>
      <br>
      <br>
      <br>
      Em 11-07-2012 17:43, Michael Geary escreveu:<br>
    </div>
    <blockquote
cite="mid:CABJOuvqDF-DK-p3Jib7Nfj2EWn_vJMLPUbj-QKj80UyxnKu9mQ@mail.gmail.com"
      type="cite">The JSON.parse() error means just what it says: there
      is an unexpected characer in your JSON data.
      <div><br>
      </div>
      <div>You didn't show us the JSON data itself, but the screenshot
        has enough of a clue about what went wrong.</div>
      <div><br>
      </div>
      <div>Look at the call frame at the top of the stack: your
        nativeJSON() function. The variable named 'a' contains your JSON
        data, yes?</div>
      <div><br>
      </div>
      <div>Look at that JSON string. It starts with several newlines
        (Windows-style newlines with \r\n), followed by:</div>
      <div><br>
      </div>
      <div>    <--det...</div>
      <div><br>
      </div>
      <div>That is the beginning of an HTML comment. It is not JSON.</div>
      <div><br>
      </div>
      <div>Why is that in your JSON data? Look at your PHP file. It
        begins with a <?php section, but then it *ends* that section
        with ?> followed by this HTML comment:</div>
      <div><br>
      </div>
      <div>    <!--determinar inicio e fim da rota--></div>
      <div><br>
      </div>
      <div>There is your bad JSON data.</div>
      <div><br>
      </div>
      <div>The fix is easy. Here is what you should do whenever you
        write a PHP file that generates JSON or any other non-HTML
        format:</div>
      <div><br>
      </div>
      <div>1) Make sure the very first line of the file is <?php as
        you already have.</div>
      <div><br>
      </div>
      <div>2) Do not end the PHP code with ?> anywhere. Don't even
        use ?> at the end of the file! Yes, that's right, don't use
        it at the end of the file. It is not required, and using it at
        the end of the file is likely to add an unnecessary newline
        because in most editors you'll probably have a newline after the
        ?>.</div>
      <div><br>
      </div>
      <div>Those two rules insure that your entire PHP file is pure PHP
        code and does not have any spurious HTML code or HTML comments
        sneaking into your output data.</div>
      <div><br>
      </div>
      <div>Of course, you will also now need to change your HTML
        comments to PHP // comments.</div>
      <div><br>
      </div>
      <div>That should fix the JSON parsing error. At least it will
        insure that what the PHP code outputs is what you expect it to
        output.</div>
      <div><br>
      </div>
      <div>-Mike<br>
        <br>
        <div class="gmail_quote">On Wed, Jul 11, 2012 at 4:53 AM, Pedro
          Costa <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:pedrocostaarma@sapo.pt" target="_blank">pedrocostaarma@sapo.pt</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
            <br>
            This is my first mail to this list.<br>
            <br>
            I have a php script that have to return to client a geojson
            layer but it gives me this error in firebug:<br>
            <br>
            JSON.parse: unexpected character (screen shot attached)<br>
            <br>
            <br>
            the php code is that:<br>
            <br>
            <a moz-do-not-send="true"
              href="http://pastebin.com/tSCv5cnT" target="_blank">http://pastebin.com/tSCv5cnT</a><br>
            <br>
            <br>
            Can somebody help me with the error?<br>
            <br>
            thanks<br>
            <br>
            <br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            Geojson mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Geojson@lists.geojson.org" target="_blank">Geojson@lists.geojson.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.geojson.org/listinfo.cgi/geojson-geojson.org"
              target="_blank">http://lists.geojson.org/listinfo.cgi/geojson-geojson.org</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
  </body>
</html>