• jquery jason代码片段


    <script type="text/javascript">
        $(function () {

                    $("#btnOK").click(function () {
                        $.ajax({
                            type: "post",   //访问WebService使用Post方式请求                  
                            //contentType: "application/json",
                            dataType: "json",
                            url: "/Application/WenDaHandler.ashx",
                            data: {type:"g"},
                            error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); },

                            success: function (data, textStatus) {
                                if (data != null) {
                                    var con = "";
                                    var tb = "<Table>";
                                    for (var i = 0; i < data.length; i++) {
                                        tb += "<tr><td>" + data[i].UserName + "提问:" + data[i].PostTitle + "十分钟前" + data[i].LastReplyLink+ "</td></tr>";
                                    }
                                   // alert(tb);
                                    tb = tb + "</table>";
                                    $("#divContent").html(tb);
                                }
                                else {
                                    alert(textStatus);
                                    alert("msgisnull");
                                }
                            }
                        });
                    });


                    $("#btnOK").click(function () {
                        $.getJSON("/Application/WenDaHandler.ashx", { type: "g" }, function (arrs) {

                            var tb = "<Table>"; alert(tb);
                            $.each(arrs, function (i, item) {
                                tb += "<tr><td>" + item.UserName + "提问:" + item.PostTitle + "十分钟前" + item.LastReplyLink + "</td></tr>";
                            });

                            tb += "</Table>";
                            $("#divContent").html(tb);

                        });
                    });

        }); 
    </script>

  • 相关阅读:
    log4j2 标签解析
    7.3
    work-7.2
    爬取豆瓣上某个用户标记的想读的或者读过的图书信息
    python爬虫程序打包为exe程序并在控制台下运行
    爬取任意两个用户在豆瓣上标记的想读的图书信息的交集
    解决c# progressBar更新出现界面假死
    数据库死锁(大神请路过)
    Excel的下载和读取,部分代码(大神请路过)
    大数据缓存:redis
  • 原文地址:https://www.cnblogs.com/mylife_001/p/2699918.html
Copyright © 2020-2023  润新知