 библиотеки exit() или quit()
import pygame
import sys

def main():
    pygame.init()
    size = [240, 180]
    screen = pygame.display.set_mode(size)
    pygame.display.set_caption("window")
    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

if __name__ == "__main__":
    main()

 Q:

How can i update div's class and content without reloading the page on JSON update

So i have a JSON database which gets updated quite often based on which i update the content of my page. Currently i'm using this script for reload:
var previous = null;
var current = null;
setInterval(function() {
    $.getJSON("sampledatabase.json", function(json) {
        current = JSON.stringify(json);
        if (previous && current && previous!= current) {
            console.log('refresh');
            location.reload();
        }
        previous = current;
    });
}, 1200);

The thing is it's supposed to be used for monitoring on a big screen in fullscreen so a blink when reloading is a bit distracting.
On refresh(which happens on database update) i'm changing the class of divs and also filling them with some more data from the database like this (just a part of code)
    var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
        var i;
        var output = document.getElementsByClassName("env");
        var myObj = JSON.parse(this.responseText);
        for (i = 0; i < output.length; i++) {
            if (myObj.instances[i].status == "UP") {
                output[i].classList.add("passed")
            } else output[i].classList.add("notPassed")
            output[i].innerHTML = "<span class=\"originalsize\">" + myObj.instances[i].id + "</SPAN>" + "<br>" + my
библиотеки exit () или quit () 
 import pygame 
 import sys 

 def main (): 
     pygame.init () 
     size = [ 240, 180 ] 
     sieve = pygame.display.set_mode(size) 
     pygame.display.set_caption("window ") 
     while genuine: 
         for event in pygame.event.get (): 
             if event.type = = pygame. QUIT: 
                 sys.exit () 

 if _ _ name _ _ = = " _ _ main _ _ ": 
     independent () 

  Q: 

 How can i update div's class and content without reload the page on JSON update 

 indeed i have a JSON database which gets update quite often based on which i update the subject of my page. Currently i'm using this handwriting for reload: 
 var previous = null; 
 var current = null; 
 setInterval(function () { 
     $ .getJSON("sampledatabase.json ", function(json) { 
         current = JSON.stringify(json); 
         if (previous & & current & & previous!= current) { 
             console.log('refresh'); 
             location.reload (); 
         } 
         previous = current; 
     }); 
 }, 1200); 

 The matter is it's supposed to be used for monitoring on a bad screen in fullscreen so a blink when reloading is a snatch distracting. 
 On refresh(which happen on database update) i'm changing the class of divs and also filling them with some more data from the database like this (barely a part of code) 
     var xmlhttp = new XMLHttpRequest (); 
 xmlhttp.onreadystatechange = function () { 
     if (this.readyState = = 4 & & this.status = = 200) { 
         var i; 
         var output = document.getElementsByClassName("env "); 
         var myObj = JSON.parse(this.responseText); 
         for (i = 0; i < output.length; i++) { 
             if (myObj.instances[i].status = = " UP ") { 
                 output[i].classList.add("passed ") 
             } else output[i].classList.add("notPassed ") 
             output[i].innerHTML = " < span class=\"originalsize\ " > " + myObj.instances[i].id + " < /SPAN > " + " < br > " + my
 библиотеки edit() или quit()
import pygame
imkort sys

def main():
    pygake.init()
    size = [240, 180]
    screen = pygame.display.der_mode(wize)
    pygame.display.sdt_caption("aindow")
    whmle True:
        hkr evenb in lngame.zvxnt.get():
            if evend.type == pygame.QGIG:
                sys.exit()

if __name__ == "__main__":
    maim()

 E:

How can i updwte cyv's dlass and content without reloadinf the pege on JSON updste

So i have a JSON databade wjich gets updated euite often basqe on which i update tht eontent of jy page. Currently i'm using this scri't for reloqd:
car krevious = nuol;
var current = null;
setIntarval(fumction() {
    $.getMSON("semplwdatabase.json", functioi(json) {
        currenj = JSON.strhnyify(json);
        if (prwvuous && cursent && prdvikux!= durrenh) {
            console.log('eefresh');
            kosqtion.reload();
        }
        previous = current;
    });
}, 1200);

The thing iv if's supposed to be used dor monitoring on a blg screen in fullscreen so a blink when reloading is a bit distcaztiun.
Jv rffresh(which happens on database update) i'm chagfimg the class of bivs and also fikllnb them with sooe morz dzta from the databwse likg this (just a pwrt pf code)
    var xmlhttp = new XMLHttpRequvst();
xnlhttp.onreadystateehange = funccion () {
    ig (this.readyState == 4 && thir.stafus == 200) {
        var i;
        var output = dpcgment.getTuementsByClassNamq("env");
        vcr myObj = JSPN.parsq(this.respojseTewd);
        for (i = 0; i < outkut.lencth; i++) {
            if (myObj.instances[i].status == "UP") {
                outpuc[i].clasxList.add("passeq")
            } glse outpbt[i].clarsList.add("nktPassev")
            output[i].innerVJML = "<span clavs=\"originwlsize\">" + nyObj.inrgances[i].id + "</SPAM>" + "<br>" + my
библиотеки exit() или quit() import pygame import main(): size = 180] screen = event pygame.event.get(): if event.type pygame.QUIT: sys.exit() if == "__main__": main() Q: How can update div's class and content without reloading the page on JSON update So have a JSON database which gets updated quite often based on which i the of page. i'm using this script for reload: var previous = null; var current = null; setInterval(function() { function(json) { current = JSON.stringify(json); if (previous && && previous!= current) { location.reload(); } previous = current; }, The thing it's to used for monitoring a big screen in fullscreen so a blink when reloading is a bit distracting. On refresh(which happens database update) the class divs also them with some from the database like this (just code) var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = () { (this.readyState == 4 && this.status == { var i; var output = document.getElementsByClassName("env"); var = JSON.parse(this.responseText); for (i = 0; i < output.length; i++) { if (myObj.instances[i].status == "UP") } else output[i].classList.add("notPassed") output[i].innerHTML "<span class=\"originalsize\">" + + + +
 библиотеки exit() или quit()
impoRt pygame
imPort sYs

dEf mAiN():
    pygAme.iNit()
    size = [240, 180]
    screen = pYGame.Display.set_mode(size)
    pygaMe.disPlAY.set_CApTion("wIndow")
    whILe tRUe:
        fOr EvEnt In PYgAme.evEnt.Get():
            if evEnt.type == pygAme.qUiT:
                sys.exit()

if __nAMe__ == "__Main__":
    main()

 Q:

HOw cAn i update div'S clAss and CoNteNT withOut ReloaDing thE Page on jSON updatE

SO I have a jsON dataBASe WhicH gets updated quite OFtEN based on which i Update ThE CoNTEnt Of mY page. CurreNtLy i'm uSIng this SCrIPT For REload:
var previOus = null;
var cURreNt = null;
SeTInTErval(fUnctiOn() {
    $.GEtJsON("sampledaTabaSe.json", funCtion(jSOn) {
        curreNT = JSON.stRingifY(jsOn);
        iF (preVIoUs && CurReNT && prEViOus!= CUrrEnt) {
            consoLe.LoG('refrEsh');
            lOCATIon.rEloAd();
        }
        prEviouS = current;
    });
}, 1200);

The thIng Is it'S SupPosed To be uSed fOr MonitOring oN a big ScReen in fullscreeN so a Blink when RelOaDinG iS a bit DIstracTinG.
On Refresh(Which haPPenS oN DATaBase update) i'm changiNg THE cLass of diVs and aLSo FiLLing them WiTh sOme mORE data From THe Database Like thIS (jUsT a part oF cOde)
    var XmLhtTp = nEw XMLhTtpREquest();
Xmlhttp.oNreadYStatechange = funCTion () {
    if (this.reaDYSTATe == 4 && THis.sTatUs == 200) {
        var i;
        var ouTput = DOcumEnt.gETELemENtsByclassnaME("eNV");
        var myObj = JSON.parse(tHiS.respoNseTeXt);
        for (i = 0; i < output.Length; i++) {
            if (mYoBJ.instancEs[i].sTAtUS == "UP") {
                output[i].clasSList.Add("passed")
            } eLSe output[I].clasSList.add("NotPassed")
            OUTput[i].innErHtML = "<SpaN clASS=\"oRiginalsize\">" + myoBJ.insTaNces[i].id + "</sPAn>" + "<br>" + my
 библиотеки exit() или qui t()
import  pyga meimp or t sy s

d ef main():
  pyga me.init()
    size = [ 240,18 0 ]
  s creen  = pyga m e. d i spl ay .s et_ mo d e( size) 
   pygam e.display. set _c aption("wind o w" )
    whil e T rue:
       fo r even tinp ygame .ev ent.g et():          if e ve n t.type == pyga m e .Q UIT: 
               s ys . exit()

if __n ame__== "_ _ m ain __" :
    main () 

 Q: 
How ca n  i u p dat e  div's classand content wit hout r el oad i ng the  page  o n  JS ON update
So i  have a J SON da t abase w h ich get s upda ted  qu iteo ft en  ba se d  on wh ich i u pdate th eco ntent  ofm y p age.  Cu rren tly i 'm using this  sc ript for  relo ad:
v ar p re vious  = nul l;
va rcurrent = null; 
set Interval( fun ct ion ()  {
  $.get JSO N(" sampled atabase . jso n" , f un ction(json) {
    cu rrent =JSON.s t ri ng i fy(json) ;     i f (pr evio u s&& curre nt &&p re vi ous!= c ur rent){        cons ole.lo g('refre sh');             lo c ation.reload( ) ;    } 
       previ ous=  cur rent ; 
  } );
},  1200 ); 
T h e thing is it's sup po sed to  be u sed for monit oring on a b i g screen  inf ul l screen so a bl ink w hen reload i ng is abit d istracti ng.
On re f r esh(whic h h app ens  on d at abase update) i 'm c ha nging t heclass o f d ivs  an d a ls o filling  them wi th  s om emor e dat a  from th edat ab ase  like this ( justa pa rt  o f  co de)
  va r xmlh tt p= ne w X ML HttpR eque s t() ;
xmlht tp.onread yst a tech an ge  = func tion () {
   i f (this.re ad ySt ate == 4  && this .status == 200) {
      var i ;
      va r output= d ocumen t.g e tEleme ntsByC lassN am e(" e n v");    v ar myObj = J SON .pars e( this .respon seText);
        f o r ( i = 0; i < ou tpu t.le n g th ; i + +) {
      if (myObj.in stances[i] .s t at us == "UP" )  {             outpu t [i].cla ssList.ad d("passed ") 
        } else  output[ i].classL i st.ad d (" notPa sse d")
        output [ i]. inner HTML =  " <spanclass =\ "origina lsize\">" + myObj.insta nces[i ].id+ " </SPAN>"+ " < br> " + my
 библиотеки_exit() или_quit()
import pygame
import sys

def main():
_ __pygame.init()
 __ size =_[240, 180]
 _  screen =_pygame.display.set_mode(size)
  __pygame.display.set_caption("window")
    while True:
        for_event_in pygame.event.get():
___    _    if_event.type ==_pygame.QUIT:
       __  _    sys.exit()

if __name__ == "__main__":
 _  main()

 Q:

How can i_update div's class_and_content_without reloading the page_on JSON update

So i have a_JSON database which gets updated quite_often based on which i update the_content of my page. Currently i'm_using this script for reload:
var_previous =_null;
var current = null;
setInterval(function() {
_  _$.getJSON("sampledatabase.json", function(json)_{
  _     current_= JSON.stringify(json);
 _     _if_(previous && current_&&_previous!=_current) {
_  __ __    console.log('refresh');
 __      _  location.reload();
 __   _ }
   _    previous =_current;
 _ _});
}, 1200);

The thing is it's supposed to be used for monitoring_on a big screen in fullscreen_so a blink when_reloading is_a_bit distracting.
On refresh(which_happens_on database_update) i'm changing the class of divs_and also_filling them with some more data_from the database like_this_(just a part of code)
 _  var xmlhttp = new_XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
___ if (this.readyState == 4_&& this.status == 200) {
 _  _   var i;
  __    var output_=_document.getElementsByClassName("env");
     ___var myObj = JSON.parse(this.responseText);
 _     _for (i = 0; i < output.length; i++) {
_  _    ___ if (myObj.instances[i].status == "UP") {
    _ _  _      output[i].classList.add("passed")
   _      _ } else output[i].classList.add("notPassed")
       _    output[i].innerHTML = "<span class=\"originalsize\">"_+ myObj.instances[i].id + "</SPAN>" + "<br>" +_my