0

I've got in my variable (events) two objects: enter image description here

I'm trying to get "title" from each object and then send them with ajax two my php file where I will have to separate arrays:

array(
    title = "All Day Event";
},
array(
    title = "sdfsdf";
}

I've no idea how to do this. I've tried to acces "title" with:

events['title]

and

events.title

But it doesn't work.

1
  • Your code is typo'd, correct them maybe? Commented Jan 18, 2016 at 19:28

2 Answers 2

2

You can get two title like following.

var title1=events[0].title
var title2=events[1].title
Sign up to request clarification or add additional context in comments.

Comments

2

events is an array..

events[0].title or events[0]['title'] will work fine. or use a loop.

for (var i = events.length; i--;) alert(events[i].title);

1 Comment

It's exactly what I need! Thanks!

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.