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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:46:31+00:00 2026-05-14T08:46:31+00:00

function checkauth(){ jQuery.getJSON(/users/checkauthjson, null, function(xhr){ if(xhr.success){ return true;}else{ return false;} }); } Obviously, that

  • 0
function checkauth(){
       jQuery.getJSON("/users/checkauthjson", null, function(xhr){
           if(xhr.success){ return true;}else{ return false;}
            });
   }

Obviously, that does not work, but it illustrates what i want to achieve. I want checkauth to return a value which is checked against an ajax server script.

How do i do this?

  • 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-14T08:46:31+00:00Added an answer on May 14, 2026 at 8:46 am

    getJson() is an asynchronous method by default, so you cannot rely on it without doing some adjustments.
    Use .ajax() function, setting async param to false, and then assign result to a var whose scope is in the checkAuth() function.

    Something like this:

    function ceckAuth() {
      var ret = false;
      $.ajax({
        url: '/users/checkauthjson',
        dataType: 'json',
        data: '',
        async: false,
        success: function(result) { ret = result.success; },
        error: ...
      });
      return ret;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function checkuser(user) { var ret = false; $.ajax({ type:'POST', url:'user.php', async:false, data:{'user':user}, success:function (data)
<form method=post action=/Order/CheckOut/ onSubmit=return Validate()> and then... function Validate() { alert($(#email).val()); return false; }
i have js function function addAllToCart(){ var have_result = false; jQuery(input#qty).each(function(indx, e){ if (e.value
function getDbValue() { alert($('[data-bind]').length); alert($('[data-bind][0].data-bind')); alert($('[data-bind][0].value')); jQuery.each($('[data-bind]'), function(databind,key) { alert(key); alert(databind); alert(databind[key].data-bind); }) }
I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I have the following code to allow users to invite thier Facebook friends: function
I have created a function that restricts route access by verifying that a stored
I know this can't be done with iFrames or the default jQuery load function,
I have a jQuery application, a shopping cart, that posts back info to the
function Apple(){ this.name=apple; } function Orange(){ this.name=orange; this.apple = new Apple(); this.apple.onCalled=function(){ alert(this.name); }

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.