I have a php page which loads a bit slow (SOAP client connection). In the php page I have a jquery page loader, but the loader is running only after the SOAP client retrives the data (after 30-40 sec).
Is there a way to load the loader script before php script so the end user can view page is loading until the SOAP client retrives all the data ?
php page is strating with below lines
<?php
session_start();
?>
<?php include 'includes/includes_hotel-rezultate.php';?>
<!DOCTYPE html>
<html>
<head>
Loader script is
<script type="text/javascript" src="js/pace.min.js" data-pace-options='{ "ajax": false }'></script>
<script type="text/javascript" src="js/page-loading.js"></script>
This is not possible. Server side code (ie. PHP) will always be run before any JavaScript gets run on the client.
If you want to keep the UI responsive whilst a long running request is made use AJAX.