Hello,
I’ve read a lot about pjax lately. The ajax request I call returns html code. I’d like to append the html to the container. However it seems that pjax only replaces html in the container and doesn’t not append it. Am I right?
Thanks,
Alex
Hello,
I’ve read a lot about pjax lately. The ajax request I call returns html code. I’d like to append the html to the container. However it seems that pjax only replaces html in the container and doesn’t not append it. Am I right?
Thanks,
Alex
from pjax https://github.com/defunkt/jquery-pjax/
Introduction
pjax is a jQuery plugin that uses ajax and pushState to deliver a fast browsing experience with real permalinks, page titles, and a working back button.
pjax works by grabbing html from your server via ajax and replacing the content of a container on your page with the ajax’d html. It then updates the browser’s current URL using pushState without reloading your page’s layout or any resources (JS, CSS), giving the appearance of a fast, full page load. But really it’s just ajax and pushState.
In poor word which are the difference?
I’m not going in deeper and detailed explanation, so pass me some “approximation” in the exposition.
pajx replace content because its purpose is different than simple ajax, it aim to give fast browsing by using ajax.
It update content browser link and page title. So with it use ajax request to download only part of the resources (ie only page main content) without the need to query again for the logo, css javascript and other image and element part of the layout so it quickly update the page.
Less http request, less redrawing by the browser more speed in page load, and on the point of view of the end user a new page is loaded.
normal ajax request are “limited” to the same page, you can obtain similar effect replacing the content but it won’t update browser link and page title.
If you make your script doing so you have pjax.
Thanks for your reply. I’ve already read all that but you kind of enlighten me with your explanation. I wanted to fit pjax to a usecase that is not appropriate to its purpose.