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

  • Home
  • SEARCH
  • 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 7091315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:10:11+00:00 2026-05-28T08:10:11+00:00

My problem is really weird. I’m working in phonegap. I got a function called

  • 0

My problem is really weird. I’m working in phonegap.

I got a function called “krijgSpellen”. I call that function when “device ready” like so:

// Wait for PhoneGap to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // PhoneGap is ready
    //
    function onDeviceReady() {
        readFile();

        var options = { frequency: 3000 };
        watchID = navigator.geolocation.watchPosition(onSuccess, onError, options);

        krijgSpellen(); <--



    }

but here is the weird part, when I do this:

function krijgSpellen(){


            $.getJSON("gegevens.txt",function(result){

// Get all the games
$.each(result.games, function(){
    $(".gamelijst").append("<li><a href='' id=" + this.id + " data-theme='a'>"+ this.game + "</a></li>");


                });

            $(".gamelijst, $.mobile.activePage").listview('refresh');


                      });   
};

That works, but when I do this:

function krijgSpellen(){


        $.each(jsonopgehaald.games, function(){
               $(".gamelijst").append("<li><a href='' id=" + this.id + " data-theme='a'>" + this.name + "</a></li>");
               });

        $(".gamelijst, $.mobile.activePage").listview('refresh');

    };

It doesn’t work, and I have the same code on an hyperlink and when I click the hyperlink it does work. And I really need the method where it doesn’t work to do it.

By the way

jsonopgehaald = {"games":[{"id":"2","name":"bartje","photo":"photo2.png","description":"kimpe","length":"is","totalDownloads":"0","totalFinished":"0","locations":[{"id":"3","name":"loc21","photo":"loc21.jpg","description":"loc21","FK_Game_id":"2","lat":"51.0000","long":"4.0000","status":"0"},{"id":"5","name":"loc22","photo":"loc22.jog","description":"locatie 22","FK_Game_id":"2","lat":"51.2330","long":"40.2222","status":"1"}]},{"id":"3","name":"aa","photo":"photo3.jPg","description":"aa","length":"aa","totalDownloads":"0","totalFinished":"3","locations":[{"id":"4","name":"loc4","photo":"loc4.jpg","description":"loc4","FK_Game_id":"3","lat":"51.2191","long":"4.4021","status":"0"}]}]}
  • 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-05-28T08:10:12+00:00Added an answer on May 28, 2026 at 8:10 am

    Try this:

    function krijgSpellen(){
    
        $.each(jsonopgehaald.games, function(index, value){
               $(".gamelijst").append("<li><a href='' id=" + value.id + " data-theme='a'>" + value.name + "</a></li>");
        });
    
        $(".gamelijst, $.mobile.activePage").listview('refresh');
    
    };
    

    I tested it and it works. Added the index and value to function().
    value is a reference to the array you are currently in.

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

Sidebar

Related Questions

ive got a really weird problem. i have no clue why its not working.
This is a really weird problem that I have been having. When I download
I've got a really weird problem and i'm wondering if it's a visual's bug
I have a really weird problem with /bin/bash and a script that uses printf
Ok this is a really weird problem. I wanna start off by saying that
I have a really weird problem with JS and jQuery. $('#skip').click(function(e) { savePhoto('skip'); showNextPlace();
I got a really weird problem here and I absolutely cannot understand why this
This is the second time that I have this really weird problem with WCF
I've got a really weird problem with ZF (at least for ZF newbie): I
im a newbie to flash,and i hav got this really weird problem.i have created

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.