This is the data in the JS file:
[{\"value\":16633,\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":16910,\"name\":\"jamesw@wk3.org\"},{\"value\":16911,\"name\":\"sdasfasf@joindiaspora.com\"}]" ),
and I want to output it in a 2d array something like:
value name,
16633 fdgdfgdf@joindiaspora.com,
16910 jamesw@wk3.org,
16911 sdasfasf@joindiaspora.com
here is my code so far:
$.ajax
({
async: false,
type: 'GET',
url: 'https://wk3.org/conversations/new',
success: function(data)
{
var matches;
var Ragex = /\\"value\\":\\"(.*)\\",\\"name\\":\\"(.*)\\"},/g //need to sort out the REGEX so it goes through each name and ID seeing if it equals ID
while ((matches = Ragex.exec(data)) !== null)
{
console.log(matches);
}
}
});
which outputs:
["\"value\":\"16633\",\"name\":\"fdgdfgdf@joindiaspora.com\"},…"},{\"value\":\"16910\",\"name\":\"jamesw@wk3.org\"},", "16633\",\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":\…"name\":\"sdasfasf@joindiaspora.com\"},{\"value\":\"16910", "jamesw@wk3.org", index: 92, input: "<script>↵ //<![CDATA[↵ $(document).ready(funct…it" value="Send" />↵</div>↵</form>↵</div>↵</div>↵"]
$.ajax
({
async: false,
type: 'GET',
url: 'https://wk3.org/conversations/new',
success: function(data)
{
var matches;
var name;
var regex = /{\\"value\\":\\"([^"]*)\\",\\"name\\":\\"([^"]*)\\"}/g //need to sort out the REGEX so it goes through each name and ID seeing if it equals ID
while ((matches = regex.exec(data)) !== null)
{
console.log(matches);
var name = matches[2];
if(name == ID)
{
result = matches[1];
}
else
{
console.log("FAIL");
//this sends a message to me only
//need to add error trapping saying recipient cannot be found!
}
}
}
});