I am currently using AJAX to pass the PHP output to JavaScript, but I want to pass only one of the PHP variables to JavaScript and I don't know how to obtain it from the general this.responseText property.
I've tried searching Stackoverflow/Google but most questions/answers talk about returning the entire PHP output. What I want is not the entire PHP output (I've got that settled already), but one variable from the PHP code. This is the PHP output I have now:
echo $hex;
echo '<br>';
echo 'R: ' . $r . ' G: ' . $g . ' B: ' . $b;
What I want is to get just the $hex variable. How do I obtain it?
EDIT To those who marked it as a duplicate:
I have read the replies to that question, but I felt like it didn't exactly answer my question, so I posted a new one. In the Ajax example, there is only 1 output (42) and it is in this.responseText. I am outputting a couple of sentences using this.responseText but I also want one of the variables in it for a separate javascript function. How do I extract it from this.responseText?