Below you have a simple melody and chord progression. This is the first four bars of 'When The Saints Go Marching In', a well know jazz tune. So, the first thing to do to play this tune in a jazz style is to memorize the melody and the chord progression. Learning the melody is just memorizing what you see. *
Below you have an exercise to learn the chord progression. The notes spell out each chord as it passes in time to the music. It's important to know the chord progression just as well as the guitar player or bass player would know them. While the music is going by, you have to be thinking melody and chords.
And below, you have a combination of the chord notes and the melody notes making up a finished jazz tune called 'When The Saints go Marching In'. When studying the below four bars, you will find notes of the chord and notes of the melody in every bar. And if you play this, you can hear the original melody coming through.
I know this is a real simple explanation of how jazz works, but it does cover the basis of what a jazz musician might be thinking at the time of his improvisations. However, after years of playing , the musician is not really thinking of the technical part of the music totally. He or she is only riding on the song using the melody and the chord progression as an outline for the song. Speaking of the 'years of playing', there are also years of studying attached to any jazz musician. Below is the cycle of fourths going clockwise and the cycle of fifths going counter clockwise. This is a tool to learn the major chords in music.

Notice how the above tunes' chords relate to the below cycle. The tune is in the key of 'G' and the other chords used are right next to the 'G' chord in the cycle. There are exceptions to this, notice the 'C#' chord. In the cycle, the 'C#' chord is on the opposite side of the cycle. In general, however, the old jazz tunes follow the cycle in their chord progressions.
This is why this tool is so important to jazz players. Memorizing the cycle forward and backwards allows the player to become accustom to the 'progression' of the chords in most jazz tunes. Playing the triad of notes making up the chord would be playing the notes: C, E, and G of the 'C' chord. The 'F' chord is made up of the triad: F, A, and C. Etc around the cycle. Below is an exercise to play the cycle of fourths. By reading it backwards, you would be studying the cycle of fifths.
* The four measure examples are written for the Bb instruments (like the clarinet or trumpet). The sample recordings are in the concert key of F.
Chord Progression
Jazz style - When The Saints Go Marching In
Cycle of fourths/fifths
Cycle of fourths/fifths