Ajax请求

   //产生随机数

        function GetRandomNum(Min, Max) {

            var Range = Max - Min;

            var Rand = Math.random();

            return (Min + Math.round(Rand * Range));

        } 

  //获取文件列表  显示

        $(function () {

            var tempValue = GetRandomNum(1, 1000);

            var Id = $("#txtId").val();

            if (Id != "") {

                var queryString = "FlowFlag=3&Id=" + Id

                $.ajax({

                    type: "get",

                    async: false,

                    url: "../Handler/getFileName.ashx?" + tempValue,

                    data: queryString,

                    dataType: "html",

                    timeout: 30000,

                    success: function (json) {

                        $("#FileList").html(json);

                    },

                    error: function () {

                    }

                });

            }

            var tempValue2 = GetRandomNum(2, 2000);

            var FId = $("#txtFId").val();

            if (FId != "") {

                var query = "FlowFlag=3&Id=" + FId

                $.ajax({

                    type: "get",

                    async: false,

                    url: "../Handler/getFileName.ashx?" + tempValue2,

                    data: query,

                    dataType: "html",

                    timeout: 30000,

                    success: function (json) {

                        $("#FileList").html(json);

                    },

                    error: function () {

                    }

                });

            }

        })

  

你可能感兴趣的:(ajax请求)