Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:04:59+00:00 2026-06-18T04:04:59+00:00

I made a mobile webpage with jQuery Mobile. I load the tweets using jQuery’s

  • 0

I made a mobile webpage with jQuery Mobile. I load the tweets using jQuery’s .ajax() method on page load. It works but when I change the page by clicking a link, the tweets won’t load anymore.

Here’s the HTML:

<ul data-role="listview" data-divider-theme="c" data-inset="true" id="tweets">
    <li data-role="list-divider">Latest Tweets</li>
</ul>

Javascript:

$(document).bind('pageinit',function(){
    $.ajax({
        url:'https://api.twitter.com/1/statuses/user_timeline/LicsonLee.json',
        dataType:'jsonp',
        success:function(data){
            $.each(data,function(i){
                if(i < 5){
                    var tweet = data[i];
                   $('#tweets').append($('<li/>').html('<a href="https://twitter.com/'+tweet.user.screen_name+'/status/'+tweet.id_str+'" data-rel="external"><h4>'+tweet.text+'</h4><p>at '+tweet.created_at+'</p></a>'));
                 }
            });
            $('#tweets').listview('refresh');
        }
    });
});

The page that has problem

Current progress

I’ve tried Gajotres’ answer but it still worked once only. The pages are loaded through AJAX. I also checked that other pages’ HTML structure are correct. I still cannot figure out why this is happened.

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:05:01+00:00Added an answer on June 18, 2026 at 4:05 am

    Solution

    This should not be used in this case :

    $(document).bind('pageinit',function(){
    

    it will trigger only once, instead this should be used:

    $(document).bind('pagebeforeshow',function(){
    

    EDIT :

    This should do it:

    $(document).on('pagebeforeshow', '[data-role="page"]', function(){   
    

    If you want to find out more about this take a look at my ARTICLE, to be more transparent it is my personal blog. Or it can be found HERE.

    EDIT 2 :

    This solution works:

    $(document).on('pageshow',function(){
        $.ajax({
            url:'https://api.twitter.com/1/statuses/user_timeline/LicsonLee.json',
            dataType:'jsonp',
            success:function(data){
                $('#tweets *:not([data-role=list-divider])').remove();
                $.each(data,function(i){
                    if(i < 5){
                        var tweet = data[i];
                        $.mobile.activePage.find('#tweets').append($('<li/>').html('<a href="https://twitter.com/'+tweet.user.screen_name+'/status/'+tweet.id_str+'" data-rel="external"><h4>'+tweet.text+'</h4><p>at '+tweet.created_at+'</p></a>'));
                    }
                });
                $.mobile.activePage.find('#tweets').listview('refresh');
            }
        });
    }); 
    

    Each time you were appending content it was appended to the #tweets at a first page, this will append it only to the currently active page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made an application using jQuery mobile, but now I have a huge problem.
http://jsfiddle.net/kCMvt/ Hey everyone. I made this jQuery page for a mobile phone, but the
I am new to Jquery's Mobile site but I made this mobile website using
I have an application made by using phonegap 1.5.0 and jquery mobile 1.1.0.... I
I made a jquery mobile page with multiple data-role=page divs to navigate within the
I'm trying to pass some parameters to a page-id made in jQuery Mobile. The
I have made a simple application for my iphone using jQuery Mobile and Phonegap.
I need to provide webpage (made for desktop browsers) to be usable on mobile
I made an image slider using this plugin http://slidesjs.com/ while ago for a mobile
I'm doing a jQuery Mobile / Rails app and I made it app-capable for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.