首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

jquery:$.ajax() 容易 例子

2013-03-21 
jquery:$.ajax()简单例子function CoursewareOffShelf(o) {alert(o.id)$.ajax({type: post,url: AjaxC

jquery:$.ajax() 简单 例子
function CoursewareOffShelf(o) {
            alert(o.id);
            $.ajax(
                {
                    type: "post",
                    url: "AjaxCoursewareOffShelf.aspx",
                    data: {
                        "ApplicationId": o.id,
                        "ApplicationTypeId":2
                    },
                    success: function (data, textStatus)
                    {
                        var j = eval(data);
                        $.each(j, function (i, item) {
                            var count = item.count;
                            if (count > 0) {
                                var _mkingCount = $('#<%=lbShelfed.ClientID %>').html();
                                var _mkingCurrentCount = (_mkingCount - 1);
                                $('#<%=lbShelfed.ClientID %>').html(_mkingCurrentCount);
                                divShelfed_click();

                            }
                            else {
                                alert("课件下架申请失败!");
                            }

                        })
                    },
                    complete: function (XMLHttpRequest, textStatus)
                    {
                        //HileLoading();
                    },
                    error: function () {
                        //alert("请求出错");
                    }
                });
               

        }

AjaxCoursewareOffShelf.aspx:
Response.ContentType ="application/json";
            int count = -1;
            string ApplicationId = (Request["ApplicationId"] == null || Request["ApplicationId"] == "") ? null : Request["ApplicationId"];
            string ApplicationTypeId = (Request["ApplicationTypeId"] == null || Request["ApplicationTypeId"] == "") ? null : Request["ApplicationTypeId"];
            if (ApplicationTypeId != null && ApplicationId != null)
            {
                int _applicationId = Convert.ToInt32(ApplicationId);
                int _applicationTypeId = Convert.ToInt32(ApplicationTypeId);
                EProductApplicationBLL ebl = new EProductApplicationBLL();
               count=ebl.OffShelfApplication(_applicationId, _applicationTypeId);
              
           
            }
            Response.Write("[{ "count":"" + count.ToString() + ""}]");

热点排行