The objective of this paper is to investigate an online method to generate an optimal ascent trajectory for air-breathing hypersonic vehicles. A direct method called the Pseudo-spectral method shows promise for real-time optimal guidance. A significant barrier to this optimisation-based control strategy is computational delay, especially when the solution time of the non-linear programming problem exceeds the sampling time. Therefore, an online guidance algorithm for an air-breathing hypersonic vehicles with process constraints and terminal states constraints is proposed based on the Pseudo-spectral method and sensitivity analysis in this paper, which can reduce online computational costs and improve performance significantly. The proposed ascent optimal guidance method can successively generate online open-loop suboptimal controls without the design procedure of an inner-loop feedback controller. Considering model parameters' uncertainties and external disturbance, a sampling theorem is proposed that indicates the effect of the Lipschitz constant of the dynamics on sampling frequency. The simulation results indicate that the proposed method offers improved performance and has promising ability to generate an optimal ascent trajectory for air-breathing hypersonic vehicles.