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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:03:35+00:00 2026-05-31T15:03:35+00:00

Found several other questions with this topic, but they were syntax errors of people

  • 0

Found several other questions with this topic, but they were syntax errors of people closing their AJAX call too early which I don’t appear to have done…

Here’s my AJAX call in my jqGrid loadComplete:

loadComplete : function() {                     
    $.getJSON("getCurrentProject.html", function(results){
        alert(results);
        $(this).jqGrid('setCaption',"Project: " + results);
    });                     

},

As you can see, I’m simply calling a URL to get back a currentProject String and set the caption on the jqGrid accordingly.

Trouble is, the success function is never being invoked! I looked in Firebug and I can see the server responding with the single String value I expect (“default” in this case).

What am I missing here? Should I just be using get instead of getJSON?

  • 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-31T15:03:37+00:00Added an answer on May 31, 2026 at 3:03 pm

    Only use .getJSON() if you’re expecting the response to actually be JSON. In your case you’re expecting a string, so try:

    loadComplete : function() {
        var $this = $(this);               
        $.get("getCurrentProject.html", function(results){
            alert(results);
            $this.jqGrid('setCaption',"Project: " + results);
        },
        "text");
    },
    

    You may not need the last parameter to .get() to set the expected type to “text”, but then again maybe you will – if you don’t supply it jQuery will make an “intelligent guess” at the response type and it may guess incorrectly.

    Note that within your ajax callback this will not be the same as in the loadComplete function so you need to keep a reference to that in a variable outside the ajax callback, as shown.

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

Sidebar

Related Questions

I've found several other questions that deal with this topic, but I just can't
I found several other Uncaught TypeError based questions on SO but not this particular
I have found several other questions here on S.O. (and the web in general)
I tried several solutions found on other posts but still having problems to autoresize
I've read several questions regarding UAC and privilege elevation but I've not found a
After searching stackoverflow.com I found several questions asking how to remove duplicates, but none
I found a few questions like this but I couldn't find this particular question.
I've read several of the other questions on SO regarding Java profilers, but I
I know this looks similar to other questions here but I don't think my
I have tried to do research on this topic, but have not found an

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.