jquery - How to change a variable in server machine using javascript -


i have few html pages on server. have designed admin page , page on server. goal there button on server page. if click button index page redirected error,html page. here code in admin page

var iserror=false;     $( document ).ready(function() {       $("#turnon").hide();       localstorage.setitem('iserror', iserror);       $("#turnoff").on('click',function(){         iserror=true;         localstorage.setitem('iserror', iserror);         $("#adminmessage").text("the site turned off");         $("#turnon").show();         $("#turnoff").hide();       });        $("#turnon").on('click',function(){         iserror=false;         localstorage.setitem('iserror', iserror);         $("#adminmessage").text("the site turned on");         $("#turnon").hide();         $("#turnoff").show();       });     }); 

in above code setting localstorage variable. checking localstorage variable @ beginning of index.html page using following code

var iserror = localstorage.getitem('iserror');                 if(iserror==='true')                     {                     window.location="error.html";                     } 

but see if click button functionality works on machine have clicked button. if go site other machine not redirected error page. seems variable set in local machine redirected error page. other users not redirected error page. there way set variable in server. users accessing page redirected error page.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -