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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:26:10+00:00 2026-05-18T23:26:10+00:00

There’s a little problem with Visual Studio 2010 and Javascript Intellisense. I’ve implemented a

  • 0

There’s a little problem with Visual Studio 2010 and Javascript Intellisense.

I’ve implemented a class with some “Properties” and want to implement a “static” function, which returns a new instance of the class after an ajax-request which returns a Json-Object.

Like so:

/// <reference path="jQuery/jquery-1.4.1-vsdoc.js" />
MyClass = function (options) {
    /// <summary>MyClass Description</summary>
    /// <param name="options" type="Array">Foo1 (string), Foo2(string)</param>
    /// <field name="Foo1" type="String">Foo1 Description</field>
    /// <field name="Foo2" type="String">Foo2 Description</field>

    // [...] Some Code

    // Properties
    this.Foo1 = options.Foo1;
    this.Foo2 = options.Foo2;
}

And the function:

intellisense not working:

MyClass.MyFunction = function () { 
    /// <summary>MyFunction Description</summary>
    /// <returns type="MyClass">MyClass</returns>

    $.ajax({
        type: 'GET',
        url: '/Foo/Bar',
        dataType: 'json',
        success: function (result) {
            return new MyClass(result);
        }
    });
}

intellisense working:

MyClass.MyFunction = function () { 
    /// <summary>MyFunction Description</summary>
    /// <returns type="MyClass">MyClass</returns>

    var foo = new MyClass({'foo1': 'a', 'foo2': 'b'});
    $.ajax({
        type: 'GET',
        url: '/Foo/Bar',
        dataType: 'json',
        success: function (result) {
            foo = new MyClass(result);
            return foo;
        }
    });

    return foo;
}

When I call the function from another function, like:

$(document).ready(function() {
    var foobar = MyClass.MyFunction(); // returns Object of type "MyClass"
    alert(foobar.Foo1); // At this Point, the intellisense doesn't work correct
});

my intellisense isn’t working anymore (or works with the double-return), because the return of MyFunction is within the ajax-request. If I place the return at the end of the function, the intellisense is working again. But in this case I have two returns. The first from the function and the second from the ajax-success.

It seems that the <returns...></returns> only works when the return is at the end of the function. That’s bad, because I just need one return when the ajax-request is completed.

I don’t know how to deal with this problem. Hope you can help me to fix 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-18T23:26:11+00:00Added an answer on May 18, 2026 at 11:26 pm

    The return from inside the “success” callback is not going to work anyway. It’ll return from that function, but nothing is going to pay attention to the return value, and in particular the return value from the “success” function will not be the return value from “MyFunction”.

    If what you want is for “MyFunction” to fetch a value and allow some code to work on it, then that code will have to be passed in to “MyFunction” and called in the “success” function. Thus, instead of:

    var thing = MyClass.MyFunction();
    /*
      do stuff with "thing"
    */
    

    you’d change “MyFunction” around so that you could do this:

    MyClass.MyFunction(function(thing) {
      /*
        do stuff with "thing"
      */
    });
    

    The function would look something like this:

    MyClass.MyFunction = function (doStuff) { 
      /// <summary>MyFunction Description</summary>
    
      $.ajax({
        type: 'GET',
        url: '/Foo/Bar',
        dataType: 'json',
        success: function (result) {
            doStuff(new MyClass(result));
        }
      });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a conversion process that is needed when migrating Visual Studio 2005 web
There are a few ways to get class-like behavior in javascript, the most common
There are two popular closure styles in javascript. The first I call anonymous constructor
There is previous little on the google on this subject other than people asking
There are two weird operators in C#: the true operator the false operator If
There seem to be many ways to define singletons in Python. Is there a
There are numerous Agile software development methods. Which ones have you used in practice
There are several types of objects in a system, and each has it's own
There is a field in my company's Contacts table. In that table, there is
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql

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.