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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:33:52+00:00 2026-06-02T23:33:52+00:00

I have a strange (probably not for some I would wager) problem, I have

  • 0

I have a strange (probably not for some I would wager) problem, I have a JavaScript method to call all of my ajax calls, please see below.

function ajaxCall(url, params) {
if (params === null) {
    $.ajax({
        type: 'POST',
        url: url,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json'
    }).success(function(response) {
        return response;
    }).error(function(response) {
        return response;
    });
} else {
    var data = JSON.stringify(params);
    $.ajax({
        type: 'POST',
        url: url,
        data: data,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json'
    }).success(function(response) {
        return response;
    }).error(function(response) {
        return response;
    });
  }
}

when I call this method I get the appropriate response from the AJAX call and all looks rosy, until I return the response the call is returned undefined?

for completeness I will include my call code.

var call = ajaxCall(someUrl, someParams);

just to clarify and make sure my ramblings are understood call would be undefined in the above example?

  • 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-02T23:33:54+00:00Added an answer on June 2, 2026 at 11:33 pm

    you can’t do that because the ajax call is async,
    $.ajax returns a Deferred Object and you can work with it to get what you need
    read on it here

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

Sidebar

Related Questions

I realize it's probably something strange, but here is what I have. I have
I have strange behavoir in a ViewBinder. All works good on TextViews. With CheckBoxes
i have strange problem doing reporting: i have numerous clients with different issued invoices.
I have strange problem with receiving data from socket. On client im using air
I have strange error and not sure how to tackle it without wasting too
I have a strange problem that I've never encountered before, I have data in
I have a strange problem that I can't get my head around: I have
I'm trying to learn python and have encountered some strange behaviour. I am experimenting
I have a very strange problem. (fyi - I'm using forms authentication and manually
Sorry for my English. I have a strange problem. When user click adword link,

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.