- function GetNotification() {
- debugger;
- $.ajax({
- type: "POST",
- url: "@Url.Action("GetNotification", "GetChat")",
- data: "",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (data) {
- $('#dvMsg').empty();
- debugger;
- result = data;
- $('#dvMsg').append('');
- for (var j = 0; j < result.length; j++) {
- $('#dvMsg').append('From:' + result[j].author + ' Message:' + result[j].body + '
- ');
- }
- },
- error: function (result) {
- }
- });
- }
- setInterval(showMessage, "100000");
- public JsonResult GetNotification()
- {
- WebClient client = new WebClient();
- client.Headers["Content-type"] = "application/json";
- client.Encoding = Encoding.UTF8;
- //Testing tt = new Testing();
- //tt.lastMessageNumber = "100";
- string response_message = client.DownloadString(apiUrl + "messages?token=kzwfwna7auyj5ubp");
- Messsage resp = (new JavaScriptSerializer()).Deserialize(response_message);
- var data = resp.messages.Where(x => x.chatId == Convert.ToString(Session["ChatId"])).Select(x => new { x.body, x.author, x.time }).OrderBy(x => x.time).ToList();
- return Json(data, JsonRequestBehavior.AllowGet);
- }
Loading

Madan ShekarPosted Dec 7, 2018, 3:40 AM