0

I'm doing an AJAX request with jQuery and trying to access the value in an object that is returned by the Post request , but when i try to use it like this result.VideoCode it shows undefined ( using console.log ) but when i do a console.log(result) it shows that there is an object and there is data in it

here is a screenshot

JS object

Any ideas tho why this is happening and how can i fix it ?

Update:// the server was returning an array of objects with a single object in it ... so that solved the mystery ... should have figured it out earlier

3
  • Only VideoCode returns undefined? Have you tried not using capital letters? Commented Aug 6, 2011 at 22:16
  • Can you post a code snippet or gist? My guess is there's something else relevant happening in your code that we can't see. Commented Aug 6, 2011 at 22:17
  • Update:// the server was returning an array of objects with a single object in it ... so that solved the mystery ... should have figured it out earlier Commented Aug 6, 2011 at 22:20

1 Answer 1

4

Looking at the screenshot, result is an array containing one object.

You'd need to access it like:

result[0].VideoCode

which means: The first element of results, then from that object the VideoCode property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.