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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:34:58+00:00 2026-05-24T19:34:58+00:00

I am having some issues getting my JS to work right. I am trying

  • 0

I am having some issues getting my JS to work right. I am trying to select an option from a dropdown which then calls this function. The function is being called properly (type is set to ‘truck’ and id is set to 5). I want to then use the data returned to populate several fields. The alert() I added to test gives me “undefined”.

Here is my JS:

 function getDueDates(type, id) {
     $.getJSON("loadVehicle.php",
     {
         id: id,
         type: type
     },
         function(data) {            
            alert( "TEST: " + data.year);
             $("#inspection_due").val(data.inspection_due);
             $("#short_due").val(data.short_due);
             $("#full_due").val(data.full_due);
         }
 )};

When I check the loadVehicle page manually (with id=5, type=truck) I get:

[{"truck_id":"5","status":"A","truck_number":"21","year":"1999","make":"Freightliner","model":"Classic","engine":"Detroit","vin_number":"1FUPCSZB2XPA16977","transmission_number":"","tire_size":"","inspection_due":"2009-04-30","short_due":"0000-00-00","full_due":"0000-00-00","comments":"Caf Inc Truck","web_id":"b963940bfd96528f7fd57c08628221f0","last_update":"2009-03-09 16:26:28"}]

But in the page the alert comes up with “TEST: undefined”

  • 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-24T19:34:59+00:00Added an answer on May 24, 2026 at 7:34 pm

    You need data[0].year since you are getting an array containing a single object.

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

Sidebar

Related Questions

Having some issues getting this MPMoviePlayerViewController to work. I have two sample URLs pointing
I am having issues getting this to work, here is what I am trying
We are having some issues getting SharePoint to work as we want it to.
I'm having some issues with getting cookies to work when using a ProxyPass to
Having issues getting jQuery to work in this scenario: Visual Studio 2010 .Net 4.0
i'm having some issues getting the .Filter() method to work in subsonic, and i'm
I'm having some major issues with getting JOGL to work on snow leopard. I've
I'm having issues getting some scoping right with the below app. by the time
I'm having some issues with getting my mouse events to work. I have a
I'm trying to work with the Zigfu API but I am having some issues.

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.