A
A
Alexander2015-10-26 14:31:01
PHP
Alexander, 2015-10-26 14:31:01

How to display block via php and not via ajax?

Good afternoon! There is an advanced search module, in which, after loading the page, a part is displayed using an ajax request:

loadS = function(cat)
            {
            if(fieldsHTML == 'none')
              {
              $("#search_fields").html('<center><img src="{%$settings.path%}images/ajax-loader.gif" height="19" /></center>');
     	 	}
   	 	$.ajax({
         type: "GET",
         url: "{%$settings.path%}search_ajax/",
         cache: false,
         data: "cat_id=" + cat,
         success: function(html){
         		if(html != fieldsHTML)
            {
            $("#search_fields").html(html);
                        fielS(fields);                                                
            }
          fieldsHTML = html;
        }
        });

            };

Here is an example (search is in the center)
This part is loaded later, not together. Is there any php or javascript way that can replace the ajax request and output the given module along with the page load?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav, 2015-10-26
@Alexander_Ku

1. climb into PHP, where the general page is displayed, add the output of the information you need there
2. or attach a general Ajax page loading indicator to the page so that the page is displayed when ALL content on the site is loaded. make it remove on the ajax event - success
ajax- and native php- have slightly different logic of work, one is front, the other is back.
so just "replacing" one with the other is not an option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question