when my page loads, I’m using .ajax to calls server side code and return json. The issue I’m having is I get an empty array. So inside my “success: function(data)”, it’s saying data[0].id is undefined. Is there any way to handle this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You can check the
.lengthproperty before accessing it, return or do something else if it’s0, like this: