# AJAX - Accessing id values inside responseText after statechange

**URL:** <https://forum.kirupa.com/t/ajax-accessing-id-values-inside-responsetext-after-statechange/222350>\
**Category:** web dev\
**Created:** [April 12, 2007, 5:14pm UTC](https://forum.kirupa.com/t/ajax-accessing-id-values-inside-responsetext-after-statechange/222350 "2007-04-12T17:14:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratherblue](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ratherblue/32/2052_2.png) [@ratherblue](https://forum.kirupa.com/u/ratherblue)\
**Post date:** [April 12, 2007, 5:14pm UTC](https://forum.kirupa.com/t/ajax-accessing-id-values-inside-responsetext-after-statechange/222350/1 "2007-04-12T17:14:44Z")

</div>

A little AJAX fun, been messing with this for the past two days:

```auto
request = new XMLHttpRequest();

request onreadystatechange = function(){
        if(request.readyState == 4){
            var ajaxDisplay = document.getElementById('displayDiv');
           ajaxDisplay.innerHTML = request.responseText;
        }
}

```

Now here’s the problem. After I have set displayDiv to whatever the responseText was, I can’t access the id’s inside it using document.getElementById. I get the nice “…has no display properties” error because the document physically does not contain the responseText.

I know other people have run into this problem, and I am wondering what you did to fix it 🙂
