PatrickLouys / no-framework-tutorial

A small tutorial to show how to create a PHP application without a framework.
MIT License
1.53k stars 188 forks source link

Route #63

Closed hendrixroa closed 6 years ago

hendrixroa commented 7 years ago

How add route rest and redirect async data via ajax in the part of router ?

phillipsharring commented 7 years ago

Do you mean RESTful routes? Redirect is possible in the patricklouys/http library that is used in the tutorial. The Response object has a redirect method described in the docs. With the right response headers, integrating this into Ajax would be pretty simple. You might make another Renderer like the FrontendRenderer in the example, except set it up with some default headers already set, like content type.