I am using xmlhttprequest to get json string from phpcurl from a php file and put the value on document.getElementById("div1").innerHTML = xhttp.responseText then retrieve the value of document.getElementById("div1").innerHTML to a variable before I am able to parse it.

I would like to directly put the responseText to variable without passing to element innerHTML.

Ofcourse I have already tried to directly pass it to variable but the parseObject value is null.

How can I do that ? Thanks in advance.