It is said that rag-time is an important precursor to jazz. But what is it? Rag-time is simply a piano style where a proper beat is accompanied with a syncopated melody. More detailedly, while left hand is playing a march-like, 4/4 or 2/4 rhythm, right hand accompanies it with a melody that shifts or displaces the beat.
First jazz eras had greatly influenced by the ragtime style and off-beat melodies. Improvisation and "swing" feel was the essential components that separated jazz and ragtime style apart.
Try listening this amazing example of ragtime style by one of the most important inventors of ragtime, Scott Joplin: Maple Leaf Rag. (https://www.youtube.com/watch?v=pMAtL7n_-rc&t=43s)
Attention: Only rag-time is never jazz! As well as this fun song! Have fun!