0

I am new to Javascript. My req is to not show the pop up if i get list from server side as empty list. Before this requirement i was doing something like below code where as soon as user hits the URL, the popup comes as i have used window.onload . Now the requirement got changed and i need to show pop up only when there is some data from backend. Please help me on this.

<script>
    window.onload = function () {
        $('#homePopup').bPopup({
            easing: 'easeOutBack', //uses jQuery easing plugin
            speed: 550,
            transition: 'slideDown'
        })
    }
</script>

<div id="homePopup"><span class="buttonCloseModal b-close"><span>X</span></span>
  <h1>Notifications</h1>

<div class="ListContainerScroll">
        <div>
               <asp:Repeater ID="rptrNotification" runat="server" OnItemDataBound="rptrNotification_ItemDataBound">
                        <ItemTemplate>
                              <div>
                                    <asp:Literal ID="litNotificationTitle" runat="server" Text='<%# Bind("Title") %>'></asp:Literal>
                              </div>
                               <div>
                                     <asp:Literal ID="litNotificationDesc" runat="server" Text='<%# ((SPListItem)Container.DataItem)["NotificationDescription"] %>'></asp:Literal>
                               </div>
                         </ItemTemplate>
               </asp:Repeater>
                    <div class="noDataAvailable" runat="server" id="divNoDataAvailable" visible="false"></div>
        </div>
   </div>
</div>

I am doing this code in .ascx

1 Answer 1

1

A piece of code you have put inside function of the onload event of the window you are going to put inside ajax success callback (i guess you are requesting data with jQuery ajax)

$.ajax({
    url: 'http://myawesomeurl.net',
    success: function (ajaxResponse) {
        //your code start
        $('#homePopup').bPopup({
                easing: 'easeOutBack', //uses jQuery easing plugin
                speed: 550,
                transition: 'slideDown'
            })
        );  
        //your code end
    }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.