You would normally expect that to work. What content-type is your server putting in the header for the JSON data? That could be throwing it off.
Also note that a bare primitive value (true, false, null, or a string or number) is not valid JSON. The only valid JSON is either an object enclosed in {} or an array enclosed in []. However, this is not what's causing your problem. jQuery doesn't use a strict JSON parser - it simply evals the JSON text - so a bare primitive value should work fine if everything else is OK. -Mike On Thu, Nov 19, 2009 at 11:08 AM, livefree75 <jpittm...@gmail.com> wrote: > Hi, > > I'm using the following code on the client side: > $.ajax({ > dataType : 'json', > // other options > success : function(json_response) { > console.log(typeof response, response); // Using Firefox's > firebug > } > }); > > And this PHP code on the server side: > > <?php > // php processing code > $response = some_boolean_value(); > print json_encode($response); > ?> > > Now, using Firebug, I can verify that the actual JSON response coming > back is indeed either true or false (without the quotes), > which should evaluate to Javascript boolean true or false. However, > when I obtain it in the success() method of my $.ajax() call, it comes > in as a string. (e.g. "true" or "false"). i.e., the console.log() > call renders: string true > > Shouldn't it render: boolean true ? > > Is this a bug? > Jamie >