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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:55:57+00:00 2026-06-17T08:55:57+00:00

I run in to a problem whan i do somthing like this var abc

  • 0

I run in to a problem whan i do somthing like this

var abc = false;
function doSomthing(){
abc = true;
return abc;
}

and it returns false, but if i run the function twice (in console), the second time returns true.

Thanks

the orignal function

var session_id_resualt = false;

function islogdin() {
    if (localStorage.email == undefined) {
        localStorage.email = "";
    }

    if (localStorage.session_id == undefined) {
        localStorage.session_id = "";
    }

    $.post(server + "loginCheck.php", {
        loginCheck: "",
        cookie: readCookie("h"),
        session_id: localStorage.session_id,
        email: localStorage.email
    },

    function (json) {
        json = $.parseJSON(json);
        if (json.logdin) {
            if (json.logdin == "1") {
                //var s_id = json.session_id;
                session_id_resualt = json.session_id;
                //return s_id;          
            } else {
                session_id_resualt = false;
                //  return false;
            }

        } else {
            session_id_resualt = false;
            //  return false;
        }
    });
    return session_id_resualt;

}
  • 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-17T08:55:58+00:00Added an answer on June 17, 2026 at 8:55 am

    $.post is asynchronous. You’ll need to wait for the result. However, since $.post doens’t provide a simple way to change the $.ajax settings you’ll have to use $.ajax instead with async: false:

    var data = {
        loginCheck: "",
        cookie: readCookie("h"),
        session_id: localStorage.session_id,
        email: localStorage.email
    };
    
    var url = server + "loginCheck.php";
    
    var callback = function (json) {
        /* ... */
    }
    
    $.ajax({
        type: "POST",
        url: url,
        async: false, /* importan! */
        data: data,
        success: callback,
    });
    

    References:

    • jQuery.ajax()
    • jQuery.post()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently run into following problem using python 2.7: I have class like this: class
This javascript code run without problem in chrome and IE but have a problem
I am learning backbone.js following this tutorial , but I run into problem understanding
I run into this problem. I have a textarea which I only want to
I just run into another problem with my To-do-like sortable list made with Knockout
I've run into another problem while fixing up my game to use this library.
my spring-hibernate application run without problem for the past 1 week , but suddenly
I am styling a Wordpress theme but has run into problem with IE7. The
I run into this problem constantly while developing AJAX applications. Let's say I want
I run into this problem again and again; Situation there is a (large) dataset

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.