Present Code
var postinstall=function (DATA,FN) {//send request var xhr = new XMLHttpRequest (); var url= ""; Address, note Do not cross-domain Xhr.open ("post", url); Xhr.setrequestheader ("Content-type", "Application/json"); Xhr.onreadystatechange = function () {if (xhr.readystate = = 4) {var str=xhr.responsetext;console.log (str); var obj=json.parse (str); if (typeof (FN ) = = "function") {fn (obj);}}} Data=json.stringify (data); xhr.send (data);} Round Patrol
var timer=setinterval (function () {
var xhr = new XMLHttpRequest ();
var url= "";
Xhr.open ("GET", url);
Xhr.setrequestheader ("Content-type", "Application/json");
Xhr.onreadystatechange = function () {
if (xhr.readystate = = 4) {
}
}
},2000); 200 seconds Continuous Document.addeventlistener (' click ', Function (evt) {if (!evt.target.matches (". Yes")) {return;} var data={//Sent data environ:document.getElementById ("environ"). Checked, Keystone: document.getElementById ("Keystone"). Checked,glance:document.getelementbyid ("glance"). Checked,}postinstall (data , function (Resdata) {if (resdata.status== "OK") {alert ("sent successfully");});});
Use Ajax to send a checkbox-selected value to the background