Jennifer Lopez and Casper Smart

Jennifer Lopez and Casper Smart

Casper Smart supported Jennifer Lopez on the set of her upcoming movie this week.

The 44-year-old singer, who recently ended her relationship with the 27-year-old dancer after two-and-a-half-years together, was spotted hanging out with him between scenes while shooting, 'The Boy Next Door,' in Los Angeles.

A source told PEOPLE.com: "He was there all night. They were loving together. [They were] very friendly and seemed good."

The 'Booty' hitmaker, who made a whirlwind trip to the east coast of the US to promote her new album, 'A.K.A. where she enjoyed a "very flirty" night out with Maksim Chmerkovskiy last weekend, reportedly asked her ex-boyfriend to move out of her LA mansion before she returned.

But sources close to the former couple previously insisted they would remain close friends, as Casper has formed a close relationship with Jennifer's six-year-old twins, Emme and Max, with ex-husband Marc Anthony.

A friend said: "The kids adore Casper. They have a great dad in Marc and know who their dad is, but they enjoyed being with Casper. It was not a bad breakup so there is no reason why they can't see Casper in the future."