You response is JSON string. In order to use it, you should convert it to JavaScript object. eval
function can be used for that purpose:
var response = '{"Status":"True","Data":[{"Loginstatus":"Success","agentid":1004}]}';
eval('var a='+response);
alert("Status = " + a.Status);
alert("Data.Loginstatus = " + a.Data[0].Loginstatus);
alert("Data.agentid = " + a.Data[0].agentid);
UPDATE
Question has been updated since I left the answer, so here is addition to my answer :). In order to extract JSON string from the obtained XML response, you can use regular expression "<string[^>]*>(.*?)<\/string>"
like this:
var responseText = '<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://localhost:53179/hdfcmobile">
{"Status":"True","Data":[{"Loginstatus":"Success","agentid":1004}]}
</string>';
var oRegExp = new RegExp("<string[^>]*>(.*?)<\/string>", "ig");
var matches = oRegExp.exec(responseText);
var response = matches[1];
After that you can use the code written above to convert response
to JavaScript object.