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 9304307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:40:40+00:00 2026-06-18T23:40:40+00:00

i am testing Phonegap Web Storage for a small project: var listsCount = 0;

  • 0

i am testing Phonegap Web Storage for a small project:

var listsCount = 0;

tx.executeSql("SELECT * FROM list WHERE id = ?", [id], successGetList, errorGetList );

function successGetList(tx, results){
    listsCount = results.rows.length; // this will be 2, in my case
}

function errorGetList(err){
    console.log("Error processing SQL: "+err.code);
}

console.log(listsCount); // this will show 0, instead of 2

the issue i’m having is that listsCount doesn’t get set inside the successGetList method. Even if i return it there.

any ideas on how can i set that variable inside of successGetList function ?

thanks

  • 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-18T23:40:41+00:00Added an answer on June 18, 2026 at 11:40 pm

    It does get set, but your console.log call is being fired before that (that’s how asynchronous code works!). Just use the value from the callback. If you need, call another function from there, and pass your data to it.

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

Sidebar

Related Questions

I am developing a voice recorder function with PhoneGap on Android system. I'm testing
I am creating an PhoneGap application for iPhone. When I am designing and testing
Phonegap uses html source located in www folder. I was testing what happens if
I have a PhoneGap app that I'm testing on webOS, Android, and iPhone. I'm
I'm currently working on a PhoneGap app and I'm testing it on an Android
I'm building a hybrid mobile application (PhoneGap+JQM). While testing in the Android emulator, I'm
I am developing and testing my iphone app (phonegap + native) properly on iPhone
After we upgraded from phoneGap to Cordova 2.2, the application runs notable slower. We
I am developing some DB actions for my Phonegap app. I am testing the
I'm testing how to use the camera of a blackberry (5) with a phonegap

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.