Answer the question
In order to leave comments, you need to log in
Ajax or Angular filtering?
Just a few questions. Here is an example angular.github.io/angular-phonecat/step-4/app . Understandably looking for. How to implement filtering like in online stores using selects and radio buttons? And what is this anyway? Is it just looking for tex? Or creates certain queries to the database? And if you use real filtering together with php, how can you do it in an online store? I just need it in real time. Maybe better then ajax'om. Explain to me please. How to compose a request to insert the response into the DOM, but before that show the loader? Sorry, I do it somehow in php, but I never worked with ajax. That's why such stupid questions. And I still want to sleep at 4 in the morning
Answer the question
In order to leave comments, you need to log in
Write: (AngularJS)
var value=5;
$http({method: 'POST', url: server_side.php?action=get_item, data: value}).success(function(res) {
$scope.items=res;
}).error(function(res) {
alert("Ошибка");
});
If you have never worked with ajax, then it is better not to look at Angular yet. Understand jQuery and its $.ajax method If you worked with js, and even more so with jquery, then there will be no problems, everything is easily configured and written.
I would not recommend filtering like in an online store through Angular, since Angular uses js to display data, which is not good for search engines. And first of all, you need your content to be seen and easily indexed by search engines.
the server should be responsible for the lookup. angular just needs to collect the data for the request (what to filter by) and send the get request through the $http service.
In fact, it all comes down to data-binding the form, which would then take the data and request search results from the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question