Em xin chào mọi người.
Tình hình là em đang thiết kế websever của s7 1200 để giám sát và điều khiển. Em viết web bằng html. Kết quả là khi giám sát 1 đến 2 biến thì webserver chạy khá mượt và nhanh. Nhưng khi em thực hiện giám sát và điều khiển thì web của em load khá chậm (khoảng từ 4-5s dữ liệu mới hiển thị) mặc dù em đã chỉnh cứ 0,5 s là refesh 1 lần. Theo em được biết là mình phải sử dụng Ajax để khắc phục tình trạng trên. Em cũng đã tìm kiếm trên mạng về kỹ thuật Ajax, nhưng vẫn chưa hiểu. Mong mọi người giúp em cái phần code tay Ajax ạ. Em xin cảm ơn.

Đâ là phần code html của em, giám sát và điều khiển nhiều biến. Web load rất chậm.

Code:

<!DOCTYPE html>
<!-- AWP_In_Variable Name='"MotorRight"' -->
<!-- AWP_0ut_Variable Name='"In"' -->
<!--Enum Decleration-->
<!-- AWP_Enum_Def Name='MotorStatus' Values='0:"Stop",1:"Run"' -->
<!-- AWP_Enum_Def Name='LightStatus' Values='0:"Off",1:"On"' -->
<!-- AWP_Enum_Def Name='ButtonStatus' Values='0:"Off",1:"On"' -->
<!----------------------------------------------------------------------------------------------------->
<!--Enum Reference-->
<!-- AWP_Enum_Ref Name='"MotorRight"' Enum='MotorStatus' -->
<!-- AWP_Enum_Ref Name='"MotorLeft"' Enum='MotorStatus' -->
<!-- AWP_Enum_Ref Name='"Button"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button2"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button3"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button4"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button5"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button6"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Button7"' Enum='ButtonStatus' -->
<!-- AWP_Enum_Ref Name='"Light"' Enum='LightStatus' -->
<!-- AWP_Enum_Ref Name='"Light1"' Enum='LightStatus' -->
<!-- AWP_Enum_Ref Name='"Light2"' Enum='LightStatus' -->
<!-- AWP_Enum_Ref Name='"Light3"' Enum='LightStatus' -->
<!-- AWP_Enum_Ref Name='"Light4"' Enum='LightStatus' -->
<!-- AWP_Enum_Ref Name='"Light5"' Enum='LightStatus' -->
<!----------------------------------------------------------------------------------------------------->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Refresh" content="0.1">
<title>Web Server S7-1200</title>
</head>
<body BGCOLOR="silver">
<p style="color: blue; font-size: 24px; font-family: Arial;
text-align:center">Control and monitoring by Web Server</p>
<p style="color: black; font-size: 24px; font-family: Arial;">
Control Motor
<form>
<p>
<input type="submit" value="Start">
<input type="hidden" name='"MotorRight"' value ="Run">
</p>
</form>
<form>
<p>
<input type="submit" value="Stop">
<input type="hidden" name='"MotorRight"' value ="Stop">
</p>
</form>
<p style="color: black; font-size: 24px; font-family: Arial;">
Motor: :="MotorRight":</p>
<pre>
<p style="color: black; font-size: 24px; font-family: Arial;">
Status of Button I0.2: :="Button2": Status of Conveyor: :="MotorLeft":
Status of Light Q0.0: :="Light":
Status of Button I0.3: :="Button3": Status of Light Q0.1: :="Light1":
Status of Button I0.4: :="Button4": Status of Light Q0.2: :="Light2":
Status of Button I0.5: :="Button5": Status of Light Q0.3: :="Light3":
Status of Button I0.6: :="Button6": Status of Light Q0.4: :="Light4":
Status of Button I0.7: :="Button7": Status of Light Q0.5: :="Light5":
Stop All I0.1: :="Button":
</p>
</pre>
</body>
</html>