javascript - JSON object returned but not accessible via $.ajax() -


i have asp.net mvc web api calling $.ajax() method. correct json returned api, object not accessible. error received in console when trying log value "name" is:

uncaught typeerror: cannot read property 'name' of undefined

json:

[{"id":2,"name":"thom","picture":"thom.jpg","about":"i'm guy. profile. quit staring , out of here.","location":"london"}] 

jquery:

$.ajax({             cache:false,             type: 'get',             datatype: 'json',             url: 'http://localhost:3235/users/searchusers?callback=?&searchstring=' + searchstring,             complete: function (data) {                 console.log(data[0].name);             }         }); 

any appreciated. thanks!

i think mean use success function. complete function doesn't take data parameter.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -