jQuery .load() function returning nothing

I have the following block of code in Index.aspx. When I click on button the page, it reloads and shows nothing (empty page).

<div class="filter_block">
                <span>Show</span>
                <a href="#"><span class="title">full shedulle</span></a>
                <a id="buttonFindFilmByName" class="active"><span class="title">films name</span></a>
                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#buttonFindFilmByName").click(function() {
                            $('#listInfoBlock').load('cinema/filmlist');
                        });
                    })
                </script>
            </div><!-- .filter_block-->

            <div id="listInfoBlock" class="list_infoBlock">           

            </div><!-- .list_infoBlock-->

Answers


Your page is reloading because that's the standard browser 's behavior when the user clicks on a a (link) HTML element.

You can stop this default behavior by using a parameter in the click handle and calling the preventDefault method:

$("#buttonFindFilmByName").click(function(e) {
    e.preventDefault();
    ....

Return false from the click handler function to tell the browser not to follow the link. This also allows you to set a real link in href for browsers that don't support JavaScript, or in case the user turned it off.

$(document).ready(function () {
  $("#buttonFindFilmByName").click(function() {
    $('#listInfoBlock').load('cinema/filmlist');
    return false; // <====== FIX
  });
});

Need Your Help

How can I pass referece from an object in AppDelgate to ViewControllers

iphone ios ipad ios5 coremidi

I created an App using a storyboard in Xcode. the App contains an UITabBarController (TBC) and some UIViewControllers (VC), controlled from the TBC.

Want to add image to aspx rss page

c# asp.net .net rss xmltextwriter

I have a cod where my aspx.cs file writes to an aspx the xml tags.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.