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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:53:56+00:00 2026-05-16T18:53:56+00:00

I have the following snippet of code: $(‘input#teamName’).live(‘blur’, function() { var value = $(this).val();

  • 0

I have the following snippet of code:

$('input#teamName').live('blur', function() {
  var value = $(this).val();
  if (value) {
    $.getJSON('api/event_company/'+value, function(data) {
      console.log('why does this not want to work?');
    });
  }
});

Basically all it’s doing is requesting some data from the server when a form field changes. My problem is that nothing in the callback function every gets called even though I can see using firebug that it has successfully sent a request to the server and received a valid JSON response.

If I change the getJSON parameters to:

$.getJSON('api/event_company/'+value, alert('Blah'));

Then the alert pops up as expected. Any ideas what might be causing this behavior?

  • 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-16T18:53:56+00:00Added an answer on May 16, 2026 at 6:53 pm

    If the JSON is invalid, the parsing will fail and the handler won’t be called. From getJSON docs:

    Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript’s object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/.

    See if your JSON validates.

    Your second example is not correct. It should instead be,

    $.getJSON('api/event_company/'+value, function() {
        alert('Blah');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code snippet: var reg = /^[0-9]$/; $('input[type=text]').keypress(function(){ console.log(reg.test(parseInt($(this).val()))); }); When I
I have the following snippet of code: $('#messages input').live('keydown', function(e){ if(e.keyCode == 13) {
I have the following code snippet in my page. <script type=text/javascript> function expandCollapse(id){ var
I have the following code snippet: using (SPSite site = new SPSite(this.ListAddress)) { using
I have the following code snippet function receiver(callback) { console.log( callback ); } function
I have the following snippet code: my $hostname = `host \`hostname\``; which this yields
I have this following snippet of code which will when I connect to work,
I have the following snippet of code that loops through the jQuery animate function
I have the following code snippet: var matchingAuthors = from authors in DB.AuthorTable where
I have the following code snippet. $(#days).keypress(function(e){ if(e.keyCode == 13){ self.validateNightModalForm(); } }); basically,

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.