Onclick loadXMLDoc

I want to add a second element (click2.asp), so both pages click.asp and click2.asp work on the same line of code. I have tried several wrong combinations and can’t get it to work. How would you add this or is it even possible to do?

Thanks

<script>
    function loadXMLDoc(elementId, endpoint) {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById(elementId).innerHTML =
      this.responseText;
            }
        };
        xhttp.open("GET", endpoint, true);
        xhttp.send();
    }
</script>
<a href="#"  onclick="loadXMLDoc('first-element', 'click.asp')">Click Here</a>

Got it…


onclick="loadXMLDoc('first-element', 'event.asp?id=1');loadXMLDoc('second-element', 'event.asp?id=2');"
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.