I
I
Ivan Petrov2017-03-23 15:52:34
MODX
Ivan Petrov, 2017-03-23 15:52:34

How to load pages with Ajax?

Hello. How can I implement the opening of new pages without reloading pages. For example, how is it on the site makimaki.ru when choosing menu categories? Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2017-03-23
@Eridani

You send a request to the page of the view for forming a list of goods, pass in the ajax parameters ajax: 1
In the view, check the condition that if this parameter is received by the post, then return the necessary content from the view as a response. You accept data and insert a block into the content
You can, like them, assign each menu item in data-category, for example, an ID of this category and pass it as a parameter. And there sort the array or query to the database by all products that have the corresponding parent id parameter

A
Anton Anton, 2017-03-23
@Fragster

https://jsfiddle.net/zec1dzsq/4/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question