Ajax asynchronous request refresh and ajax asynchronous refresh
In the website refresh method, ajax refresh is a refreshing method with good user experience. It is a popular framework that integrates ssh and other technologies! Most commonly used! The following is a demo of a commonly used ajax refresh form.
$ (Document ). ready (function () {testchaxun (); setInterval ("testchaxun ()", 5000) ;}); function testchaxun () {/* var selectId = $ ('# proviace '). val (); */$. ajax ({type: "POST",/* cache: false, */url: "WarningAction! WarningdefQuery1.action ", dataType:" json ", success: function (data) {$ ('tr '). remove ('. dataz'); for (var I = 0; I <data. length; I ++) {if (data [I]. pState = 'hazardous ') {$ ('. table-thtr '). after ('<tr class = "datrecognition error-tr">' + '<td> </td>' + '<td>' + data [I]. pName + '</td>' + '<td>' + data [I]. uName + '</td>' + '<td>' + data [I]. bHomenum + '</td>' + '<td>' + data [I]. bNumber + '</td>' + '<td> '+ Data [I]. eStart + '</td>' + '<td>' + data [I]. wType + '</td>' + '<td>' + data [I]. wTime + '</td>' + '<td>' + data [I]. pAddress + '</td>' + '<td>' + data [I]. uName + '</td>' + '<td>' + data [I]. pState + '</td>' + '<td> <a href = "WarningAction! WaringInfor. action? WId = '+ data [I]. wId + '"> details </a> </td>' + '</tr>');} else {$ ('. table-thtr '). after ('<tr class = "datrecognition">' + '<td> </td>' + '<td>' + data [I]. pName + '</td>' + '<td>' + data [I]. uName + '</td>' + '<td>' + data [I]. bHomenum + '</td>' + '<td>' + data [I]. bNumber + '</td>' + '<td>' + data [I]. eStart + '</td>' + '<td>' + data [I]. wType + '</td>' + '<td>' + data [I]. wTime + '</td>' + '<td>' + data [I]. pAddress + '</t D> '+' <td> '+ data [I]. uName + '</td>' + '<td>' + data [I]. pState + '</td>' + '<td> <a href = "WarningAction! WaringInfor. action? WId = '+ data [I]. wId + '"> details </a> </td>' + '</tr>') ;}}}) ;</script>
WarningAction in the background! Two parameters are transferred in waringInfor. action to Implement the necessary conditions for requesting this method! Returns a json
public String waringInfor(){ w= warningService.getWarningByWid(WId); if (w!=null) { if (w.getPId()!=null) { p =patientService.getPatientByPId(w.getPId()); } } if (p!=null) { if (p.getPId()!=null) { s= sickroomService.getSickroomByPid(p.getPId()); } if (p.getPEquipmentid()!=null) { e= equipmentService.getEquipmentByEId(p.getPEquipmentid()); } } return "waringInfor"; };
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.