jsonp

$(function() {$.ajax({url: "http://****.***.com/***.html?callback=?",dataType: "jsonp",jsonp: 'callback'});});

 

  public ContentResult ***()
        {
            int state = 0;
            if (HttpContext.User.Identity.IsAuthenticated && HttpContext.Request.Url.ToString().IndexOf(".***.com")!=-1)
            {
                ConsultInfo c_info = consultService.GetConsultByUser(HttpContext.User.Identity.Name);
                if (c_info != null)
                {
                    state = consultService.SetLastActiveTime(" Id=" + c_info.Id.ToString() + " ");
                }
            }
            string call = HttpContext.Request.QueryString["callback"];
            if (!string.IsNullOrEmpty(call))
               return Content(call + "({state:" + state.ToString() + "})");
            else
                return Content("{ state = "+state.ToString()+" }");
        }

你可能感兴趣的:(jsonp)