SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2013
    Posts
    198
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    ajax load jQm button not reload - page only load

    in jquery mobile when press to reload the
    <button data-icon="arrow-d" data-iconpos="left" id="newsButton"
    does not... only load with:

    Code:
    $(document).ready(function(e) {
        $("newsButton").on("click", function(event, ui) {
    		news();
    	});
    	
            news();
    		loadDB();	
    });
    HTML Code:
    	<div data-role="header"
    			data-position="fixed"
    			data-id="vs_header">
    		<h1>News/Events - Polis</h1>
            
            <a href="#" data-rel="back" data-icon="arrow-l" data-iconpos="left">Back</a>
            <a href="#home0" data-icon="home" data-iconpos="notext">Home</a> 
    	</div>
    	<div data-role="content">
    	  <button data-icon="arrow-d" data-iconpos="left" id="newsButton" data-theme="b">Load News/Events/Announcements</button>	
    <div id="newsFeed">
        	</div>		
    	</div>
    Code:
      function news() {
        var url = "announcements.php";
    	
    	
       $('#newsFeed').html(spinner).load(url, function(responseTxt, statusTxt, xhr) {
    
        if(statusTxt=="error")
          $('#newsFeed').html("Error: "+xhr.status+": "+xhr.statusText+". Check your Internet Connection, is Required!");
      });
    
       e.preventDefault();
    }

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,153
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Is "newsButton" a tag or an Id?
    i.e. shouldn't the selector be
    $("#newsButton").on("click", function(event, ui) {

  3. #3
    SitePoint Zealot
    Join Date
    May 2013
    Posts
    198
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thanks ... but got it prior you reply... now works!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •