20amps current monitoring 4-channel

Hello admin,
I’ve uploaded the files to the mentioned directory in the pi but it seems a little error in the script.js because it cant find a way to interface with HTML file and not displaying the values in the Webpage it default showing "Loading ", When I entered the Ip of pi… help me out with the javascript

Here is the code I’ve used:

window.onload=function(){
    fetchValues(valuesCallback);
}
function fetchValues(callback){
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (xhttp.readyState == 4 && xhttp.status == 200) {
            callback(JSON.parse(xhttp.responseText));
        }
    };
    xhttp.open("GET", "/CurrentMonitor.py", false);
    xhttp.send();
    return;
}
function valuesCallback(results){
    var output = "<table><thead><th>Channel</th><th>Reading</th></thead><tbody>";
    for(var i=0;i<results.length;i++){
        output+="<tr><td>Channel "+(i+1)+":</td><td>"+results[i]+"</td></tr>";
    }
    output+='</tbody></table>';
    document.getElementById('results').innerHTML = output;
    document.getElementById('header').innerText = 'Current Readings';
    window.setTimeout(function(){fetchValues(valuesCallback);}, 2000);
}

Are you getting any errors in the JS console?

What i’m currently undergoing is the

  1. Current monitoring .py is working fine
    2.script.js contains the above code which is not being fetched by the html file ,hence it always showing the “loading” page when i entered the IP from my pi ,Help me out please

So your console is saying the the file can’t be found? What browser are you trying to view this in?

In windows at chrome and in pi at chromium

In Chrome you can use Ctrl + Shift + J to open the javascript console. You should have an error there, whether it’s a 404 because the script can’t be found, or a JS error indicating it’s just not executing properly.

i think its not executing properly

Ok. Is there an error message? I need more information to help.

still working on it ninja will find it together
Wait please till i make the next response

Still Script.js not fetching data from python please help urgent

Can you post the O/P picture of 20Amps Current Monitoring 4 channel with IOT