通过jQuery动态创建asp页面

时间:2018-08-27 07:28:01

标签: jquery asp.net

var CarouselInner = $('#Image-Carousel #carousel-inner');
        $.ajax({
            url: 'WebService1.asmx/Get_News',
            method: 'post',
            dataType: 'json',
            success: function (data) {
                $(data).each(function (index, item) {  
                    if (index == 0) {    
                        CarouselInner.append('<div class="item active"><a href="#" class="Open_News_Anchor"><div class="Carousel-Image-Container" style="height:200px;width:100%"><img src="' + item.ImageMediaPath + '" style="width:100%"/></div><div class="carousel-caption"><h4 class="New_Title_H4">' + item.NewsTitle + '</h4></div></a></div>');
                    }
                    else {  
                        CarouselInner.append($('<div class="item "><a href="#" class="Open_News_Anchor"><div class="Carousel-Image-Container" style="height:200px;width:100%"><img src="' + item.ImageMediaPath + '" style="width:100%"/></div><div class="carousel-caption"><h4 class="New_Title_H4">' + item.NewsTitle + '</h4></div></a></div>')
                            .click(function () {
                                var string = window.location.pathname;
                                var path = string.substring(0, string.lastIndexOf('/') + 1) +'View'+ string.substring(string.lastIndexOf('.'));  
                                var Media='';
                                Media='<div class="media"><div class="media-right " >';
                                if (!item.MediaType)
                                {Media +='<asp:Literal runat="server"><iframe width="100%" height="auto" src="'+item.VedioMediaPath+'" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="true" class="media-object"></iframe></asp:Literal>';}
                                else
                                {Media +='<img src="'+item.ImageMediaPath+'" class="media-object" />';}           
                                Media +='</div><div class="media-body"><h5 class="media-heading"><small>'+item.InsertionDate+'</small></h5><p>'+item.NewsContent+'</p></div></div>';
                                var wind = window.open('../News_Page.aspx', '_self');
                            }));
                    }
                })
            },
            err: function (error) {
                alert(error);
            }
        })

我建立了一个具有一些新闻链接的网站,并从数据库中获取了此链接,当我单击此链接时,我要将此链接附加到事件中。通过链接)在同一母版页上,并通过jquery或JS在上面写,只是我想告诉我如何打开新的asp页(或存在一个)并通过脚本..... help在上面写上

0 个答案:

没有答案