On 2/6/07, Paul <[EMAIL PROTECTED]> wrote:

 I'm sure this is something simple but I'm going nuts.  I'm simply trying
to access JSON data that is being returned by an ajax call.  This is my
first attempt to play with JSON, so here we go…



$.get("cfc/scalehouse.cfc?method=validateTruckCode&truck_code=" + $(
"input").val(),

function(response){

                  $('#content').html(response);  //THIS OUTPUTS
{"TRUCK":"INVALID","ISVALID":false}

alert(response.TRUCK);         //THIS ALERTS "undefined"—shouldn't it
alert "INVALID"?



         });



Can you tell what I've done wrong?


In JSON, object attributes should not be in quotes. The response should
return this:

{
   TRUCK:    "INVALID",
   ISVALID:    false
}
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to