Saturday, May 15, 2010
Playing around with AJAX and returning data via JSON, I was always getting the error handler called in my AJAX call, despite getting data back from the server.

I noticed that my server code, which I'd quickly stolen from another blog, returned the JSON like this:

            oBuilder.Append("{");
            oBuilder.AppendFormat("'{0}' : {1}", "Minute", "500");
            oBuilder.Append("}");

so this would return
 { 'minute' : 500 }

All good right?

Wrong.  Jquery 1.4 now will parse valid JSON only, and that means the single quotes inside that JSON packet HAVE to be double quotes.





Saturday, May 15, 2010 10:04:32 AM (GMT Standard Time, UTC+00:00) | Comments [0] | Javascript#
Comments are closed.
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll