json-括号问题

good night

i have a doubt

what reason this output doesn't work [{"var1":"abc"},{"var2":"abcd"},{"var3":"abcde"}]

but this works

`{"var1":"abc"},{"var2":"abcd"},{"var3":"abcde"}`

i already try add this header to the php file header('Content-type: application/json'); but nothing change, the values are always undefined in the alert output

ajax code

 jQuery(document).ready(function(){
      jQuery("btn").click(function(){
         jQuery.ajax({               
         dataType: 'json', 
            url: "file.php",
            success: function(json){
               send = "first: " + json.var1+ "
";
               send += "second: " + json.var2";
               alert(send);
            }
         });
      });
   });

Your first one has the objects in an array, to access them you would need to do...

json[0].var1

...and so on.

You also have a trailing " in your success callback.