The medium-temperature T dependence of the jet transport coefficient \(\hat{q}\) was studied via the nuclear modification factor \(R_{AA}(p_\textrm{T})\) and elliptical flow parameter \(v_2(p_\textrm{T})\) for large transverse momentum \(p_\textrm{T}\) hadrons in high-energy nucleus–nucleus collisions. Within a next-to-leading-order perturbative QCD parton model for hard scatterings with modified fragmentation functions due to jet quenching controlled by \(\hat{q}\) , we check the suppression and azimuthal anisotropy for large \(p_\textrm{T}\) hadrons, and extract \(\hat{q}\) by global fits to \(R_{AA}(p_\textrm{T})\) and \(v_2(p_\textrm{T})\) data in A + A collisions at RHIC and LHC, respectively. The numerical results from the best fits show that \(\hat{q}/T^3\) goes down with local medium-temperature T in the parton jet trajectory. Compared with the case of a constant \(\hat{q}/T^3\) , the going-down T dependence of \(\hat{q}/T^3\) makes a hard parton jet to lose more energy near \(T_\textrm{c}\) and therefore strengthens the azimuthal anisotropy for large \(p_\textrm{T}\) hadrons. As a result, \(v_2(p_\textrm{T})\) for large \(p_\textrm{T}\) hadrons was enhanced by approximately 10% to better fit the data at RHIC/LHC. Considering the first-order phase transition from QGP to the hadron phase and the additional energy loss in the hadron phase, \(v_2(p_\textrm{T})\) is again enhanced by 5–10% at RHIC/LHC.