国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

layer .net中使用

2019-11-17 02:38:36
字體:
來源:轉載
供稿:網友

layer .net中使用

在.net中使用layer得用Ajax來請求一般處理程序來得到想要的json數據,直接上代碼

html:

<head runat="server">    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>layer</title>    <script src="layer/jquery-1.9.1.min.js"></script>    <script src="layer/layer.min.js"></script>    <script src="layer/extend/layer.ext.js"></script></head><body>    <div style="width: 100%; height: 100%; text-align: center;">        <div id="testMaxmin" style="width: 100px; height: 100px; background-color: #808080"></div>        <script>            $('#testMaxmin').on('click', function () {                $.layer({                    type: 2,                    maxmin: true,                    title: '網絡電視',                    area: ['580px', '350px'],                    iframe: {                        src: 'http://t.cn/zW9SbfS'                    }                })            });        </script>        <div id="testPhotos" style="width: 100px; height: 100px; background-color: #ff6a00">            </div>        <script>            var photos;            $('#testPhotos').on('click', function () {                //判斷是否已經請求過相冊,已請求過,則直接讀取緩存數據                if (photos) {                    layer.photos({                        html: '', //如果此處傳入html值,則右側區域會顯示,不傳則不顯示                        json: photos                    });                } else {                    layer.load();                    $.ajax({                        url: "handler.ashx",                        type: "post"                    }).done(function (da) {                        json = JSON.parse(da);                        photos = json;                        layer.photos({                            html: '', //如果此處傳入html值,則右側區域會顯示,不傳則不顯示                            json: json                        });                        layer.closeLoad()                    });                }            });        </script>    </div></body>

handler.ashx

public void PRocessRequest(HttpContext context)    {        javaScriptSerializer jss = new JavascriptSerializer();        context.Response.ContentType = "text/plain";        string data = "{/"status/": 1,/"msg/": /"/",/"title/": /"hahahaha/",/"id/": 8,/"start/": 0,/"data/": [{/"name/": /"qwe/",/"pid/": 109,/"src/": /"../images/1.jpg/",/"thumb/": /"/",/"area/": [638,851]},{/"name/": /"weq/",/"pid/": 110,/"src/": /"../images/2.jpg/",/"thumb/": /"/",/"area/": [638,851]}]}";        context.Response.Write(data);    }

圖片地址什么的可以自己改,一定注意要引用js,jquery要1.8以上!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 浙江省| 抚远县| 谷城县| 昌图县| 柳江县| 徐闻县| 黔南| 大同县| 新化县| 凌源市| 建平县| 嘉峪关市| 崇义县| 新泰市| 安吉县| 梓潼县| 夏津县| 高陵县| 罗平县| 远安县| 新和县| 民县| 湛江市| 建平县| 乌拉特中旗| 临城县| 芮城县| 宁蒗| 大新县| 合山市| 巴林右旗| 伊金霍洛旗| 昆山市| 托克托县| 汾西县| 南康市| 邵阳县| 丽江市| 临泉县| 涟水县| 平泉县|