I have an array returned by AJAX in jQuery. I wanted to iterate through the AJAX success result and take individual values from the JSON array. The data is returned in the form of a string. I'm using jQuery's $.ajax to get it from the server, which works fine.
//my View
$.ajax({
type: "POST",
url:"http://localhost:8888/CodeIgniter/index.php/user/usercontroller/search",//controller function
cache: false,
data:{"responsible1":res1},
success: function(data21) {
alert(data21);
});
});
//data 21 alerts the following {"taskname":"Coding","projname":"Easy Wedding"} {"taskname":"Maintain","projname":"Easy Wedding"} {"taskname":"Flow Chart","projname":"Fnn"} {"taskname":"development in ","projname":"Fnn"} {"taskname":"flow chart","projname":"Art gallery"}
How can I access only individual taskname and projectname or how can I convert data21 to an array
[{...}, {...}, {...}].