XXh model for $1/2$-spin chain I'm looking for correlation function (i.e. $\langle  g \rvert \hat{S}_i^z \hat{S}_{i+n}^z\lvert g \rangle$, where $g$ stands for ground state) for given Hamiltonian($\hat{S}^z_i = \hat{c}^+_{j} \hat{c}^-_{j} - \frac{1}{2}$):
$$\hat{H} = \frac{-J}{2}  \sum_{j} \left(\hat{c}^+_{j+1} \hat{c}^-_{j}+ \hat{c}^{+}_{j}\hat{c}^{-}_{j+1} \right) + h  \sum_j \left(\hat{c}^+_{j} \hat{c}^-_{j} - \frac{1}{2}\right)$$
with periodic boundary condition and $\left\{ \hat{c}^-_{j} \hat{c}^+_{k} \right\} = \delta_{jk}$.
My first attempt was to diagnolize hamiltonian. Noticing that $\hat{U}\hat{H}\hat{U}^{-1} = \hat{H}$ we can use something like:
$$\hat{c}^\pm_{j} = \frac{1}{\sqrt{N}} \sum e^{ipj} \hat{a}^\pm_p$$
Where $p \in \frac{2\pi}{N} \left[0; N-1  \right]$. Noticing that $\{\hat{a}^+_p, \hat{a}^-_k\}=\delta_{pk}$. 
Upd: looking for corrleation function options.
 A: First of all, there is a $\pm$ missing (in the exponent) when relating the original modes to to the Fourier-transformed ones, it should be: 
$$\hat{c}^\pm_{j} = \frac{1}{\sqrt{N}} \sum_{p \in \frac{2\pi}{N} \left[0; N-1  \right]} e^{\pm  ipj} \hat{a}^\pm_p.$$
Inserting this into the first term of the Hamiltonian, one obtains:
\begin{align}
\frac{-J}{2}  \sum_{j=1}^N \left(\hat{c}^+_{j+1} \hat{c}^-_{j}+ \hat{c}^{+}_{j}\hat{c}^{-}_{j+1} \right) 
&= \frac{-J}{2N} \sum_{p,p' \in \frac{2\pi}{N} \left[0; N-1  \right]} \sum_{j=1}^N  e^{i(p-p')j}\left(e^{ip}\hat{a}^+_p\hat{a}^-_{p'}+ e^{-ip'}\hat{a}^+_p\hat{a}^-_{p'}\right)\\
&= \frac{-J}{2N} \sum_{p,p' \in \frac{2\pi}{N} \left[0; N-1  \right]} N \delta_{p,p'} \left(e^{ip}\hat{a}^+_p\hat{a}^-_{p'}+ e^{-ip'}\hat{a}^+_p\hat{a}^-_{p'}\right)\\
&= -J \sum_{p \in \frac{2\pi}{N} \left[0; N-1  \right]} \cos(p)\,  \hat{a}^+_p\hat{a}^-_{p} ,
\end{align}
where, in getting the second line from the first, we used
$$
\sum_{j=1}^{N} e^{i(p-p')j} = N \delta_{p, p'}.
$$
Similarly, for the second term in the Hamiltonian (disregarding the constant term):
\begin{align}
h  \sum_{j=1}^{N} \hat{c}^+_{j} \hat{c}^-_{j}  &= \frac{h}{N} \sum_{p, p' \in \frac{2\pi}{N} \left[0; N-1  \right]}^{N-1} \sum_{j=1}^{N} e^{i(p-p')}\hat{a}^+_{p} \hat{a}^-_{p'} \\
&=\frac{h}{N} \sum_{p, p'  \in \frac{2\pi}{N} \left[0; N-1  \right]}^{N-1}  N \delta_{p,p'} \hat{a}^+_{p} \hat{a}^-_{p'}= h\sum_{p  \in \frac{2\pi}{N} \left[0; N-1  \right]} \hat{a}^+_{p} \hat{a}^-_{p}.
\end{align}
So in the end, we obtained the fermionic diagonalized Hamiltonian:
\begin{align}\hat{H} &= \frac{-J}{2}  \sum_{j=1}^N \left(\hat{c}^+_{j+1} \hat{c}^-_{j}+ \hat{c}^{+}_{j}\hat{c}^{-}_{j+1} \right) + h  \sum_{j=1}^N \left(\hat{c}^+_{j} \hat{c}^-_{j} - \frac{1}{2}\right)\\
&=  \sum_{p \in \frac{2\pi}{N} \left[0; N-1  \right]} \left( -J \, \cos(p)\,  \hat{a}^+_p\hat{a}^-_{p} + h\, \hat{a}^+_{p} \hat{a}^-_{p} -\frac{h}{2}\right).
\end{align}
[Note that in the derivation I used fermionic cyclic boundary conditions, i.e., $\hat{a}^\pm_{N+1} =\hat{a}^\pm_{1}$, which are not the same as the cyclic boundary conditions on a spin-chain after the Jordan-Wigner transformation.]
