Home > DeveloperSection > Forums > Disabling Pop Up in javascript
Hugh Jackman
Hugh Jackman

Total Post:52

Points:366
Posted on    November-20-2014 10:18 PM

 JavaScript C#  ASP.Net 
Ratings:


 1 Reply(s)
 561  View(s)
Rate this:

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>

 



Norman Reedus
Norman Reedus

Total Post:45

Points:315
Posted on    November-21-2014 12:18 AM

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

    }

});


Don't want to miss updates? Please click the below button!

Follow MindStick