A 31-year-old Oaklyn man who believed he was luring a 14-year-old girl for a sexual encounter found himself in jail after the online user turned out to be a cop, officials said.

Heriberto Rivera Jr. sent sexually explicit messages to an account he believed was a teenage girl but was actually being used by an undercover detective from the Camden County Prosecutor's Office's High-Tech Crimes Unit, the office said Monday.

Rivera thought the girl was going to meet him in Gloucester City on Friday so they could engage in some kind of sexual activity, the prosecutor's office said, but he was met instead by police.

This is the prosecutor's office's second such arrest in a week. Officers arrested Charles Amer, an EMT from Warminster, Pennsylvania, on Feb. 16 when he came to Pennsauken thinking he would be picking up a 14-year-old girl he met online, who was also an undercover cop.

Rivera faces charges of luring, attempted criminal sexual assault, attempt to endanger the welfare of a child and attempt to send obscene material to a minor, the office said.

Rivera works at a local Wal-Mart store, according to the prosecutor's office.

A Superior Court judge will decide Wednesday whether he should be held in jail or released on conditions pending his trial. Until then, he will remain in the jail in Camden.

The prosecutor's office was assisted in the investigation by the Department of Homeland Security Investigations - Cherry Hill Division, the Camden County Sheriff's Emergency Response Team, and Gloucester City police.

Rebecca Everett may be reached at reverett@njadvancemedia.com. Follow her on Twitter @rebeccajeverett. Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips