I have a function which returns the following coming from rest call
[{"ProjectId":"CMS","EmpId":3405,"user":"xxx"}]
which Iam storing in a variable empdata.Now I want to use that json object in that array .Every time the length would be 1.Iam trying to console empdata[0] it is giving me [ .How can I capture that json object so that I can use
答案 0 :(得分:0)
Did you tried to parse the rest answer before using it ?
var obj= JSON.parse(responseText);
var ProjectId=obj.ProjectId;
var EmpId=obj.EmpId;
var user=obj.user;