TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hardik Patel
NA
378
469.5k
how to refresh particular div using web service?
Dec 21 2013 2:34 AM
i am using below code to refresh particular div with time interval
but it's not working
<script type="text/javascript">
$(document).ready(
function () {
setInterval(function () {
ShowCurrentTime();
}, 3000);
});
function ShowCurrentTime() {
$.ajax({
type: "POST",
url: "ARcalls.aspx/Getcount", // webmethod
data: '{UserId : "' + $("#<%=Label2.ClientID%>")[0].value + '"}', // paramater pass to webmethod from masterpage
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
}
});
}
function OnSuccess(response) {
$('#show').text('I am getting refreshed');
}
ARcall.aspx.cs
ARCall.aspx/Getcount
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public string Getcount(string UserID)
{
//UserID = Convert.ToString(Session["UserId"]).ToString();
SqlConnection cn =
new SqlConnection(ConfigurationSettings.AppSettings["CnnStr"]);
SqlCommand cmd = new SqlCommand("SELECT count([id]) FROM [AR] WHERE ([UserID] = @UserID and outcome in ('Asked to Call back','Not reachable','Not recieved'))", cn);
cmd.Parameters.Add("UserID", UserID);
String unitsInStock = "";
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (dr.Read())
unitsInStock = dr[0].ToString();
}
//System.Threading.Thread.Sleep(3000);
return unitsInStock;
}
Reply
Answers (
3
)
database restore
Dynamic Columns in SQL Query - URGENT PLZZ HELP ME OUT