If, on the trial of any person before the mayor, (municipal court judge) mayor pro tempore, (municipal court judge) or city council for violation of any ordinance or law of the city, it shall appear that probable cause exists against such persons for violating the penal laws of the state, it shall be the duty of the court trying such person to commit such persons or person to prison or set bail, to answer before the court having jurisdiction of the same for the offense committed.