Not much nonsense, on the code, front desk:
The main use of the dead loop one second to read the JS once to refresh the page (recursive idea) separately to ShowData this div data to refresh
, the individual feels that it needs to be optimized. Ask the great God for guidance
<script type="Text/javascript">$ (function () {vari =0; function Settimeoutpost () {$.ajax ({type:"Post", URL:"/usercontrol/dodata.ashx", DataType:"JSON", Success:function (msg) {$ ("#ShowData"). HTML (msg[0].getinfo+i++); SetTimeout (Settimeoutpost, +); }, Error:function (req) {alert (req.readystate); } }); } settimeoutpost (); }); </script>
Background main code:
1. The naming format for the header is JSON
" Application/json ";
2. Returns a JSON-stitched string that might later be optimized to write a JSON class to generate JSON-formatted data
string " [{\ "getinfo\": \""+info[0]+"\"}] " ; Context. Response.Write (obj);
Ajax method of making local real-time updating data in JSON format