0

I'm using an ajax function to call multiple php files to the same HTML web page. Dividends must be dynamic the data is stock prices. It seems that the last stock price is only updating the other 9 are not is their a limitation to the number of ajax functions used in a single web page. Here is the code I'm using 10 times is separate div's

<div id="squotes_div7"><script type="text/javascript">

    function ajaxFunction() {
        var xmlHttp;

        try {
            // Firefox, Opera 8.0+, Safari
            xmlHttp = new XMLHttpRequest();
        } catch (e) {
            // Internet Explorer  try
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    alert("Your browser does not support AJAX!");

                    return false;
                }
            }
        }

        xmlHttp.onreadystatechange = function() {
            // only if req is "loaded"
            if (xmlHttp.readyState == 4) {
                // only if "OK"
                if (xmlHttp.status == 200 || xmlHttp.status == 304) {
                    results = xmlHttp.responseText;
                    document.getElementById("squotes_div7").innerHTML = results;
                } else {
innerHTML="ajax error:\n" + xmlHttp.statusText;
                }
            }
        }

        xmlHttp.open("GET", "/quotes/eurusdpr.php", true);
        xmlHttp.send(null);

    }

    ajaxFunction();
</script></div>

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by omar_ghassan
0

try using "var q = new ajaxFunction();" when you are calling ur ajax function. this will probably help you

Edited by fatihpiristine: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.