Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 235.4k

how to refresh a web method per a set a time interval ?

Jun 1 2016 5:20 AM
Dear All ,
 
am implemeting a asp.net project that am using asp.net,ajax jqueary
 
i have a webmethod like bellow
 
 [webmethod]
[WebMethod]
public static ColdStorage.Entity.DeviceDataDetails GetDeviceData(string abc,string cba)
{
/.... some code here to get data from data base ../ 
 
and now my jqueary finction like bellow
 
$(document).ready(function () { 
 fnGetDeviceData();
 
unction fnGetDeviceData() {
var ddlDevice =$("#ddlDevice").val();//"NHMSES0001";//
var datepicker = $("#ddlYear").val() + "-" + $("#ddlMonth").val() + "-" + $("#ddlDate").val();// $("#datepicker").val();
$.ajax({
type: "POST",
url: "Reports.aspx/GetDevicesReport",
data: "{'DeviceId' : " + JSON.stringify(ddlDevice) + ",'Date' : " + JSON.stringify(datepicker) + "}",
contentType: "application/json; charset=utf-8",
datatype: "jsondata",
success: function (ResultSet) {
if ((ResultSet.d != null) && (ResultSet.d != "undefined")) {
if (ResultSet.d.ResultStatus.StatusInd == -1) {
var getDevice = ResultSet.d.lstReportsDetails;
PopulateProducts(getDevice);
}
else {
//LoadDropDown();
alert(ResultSet.d.ResultStatus.StatusMsg);
}
}
},
});
}
 
the above program was called in the page load with 2 value and bind the data from databse ,
 
now i want to after binding the data from data base ,and after 30 seconds i want to refresh the page  and get the data from database.
 
 
now here  the time interval i would like to mainatain in web.conifg file .
 
 
please tell me how can i achive this am using asp.net,c#,ajax jqauery 
 

Answers (3)