I have a problem, I have a php code that loads 10 seconds. This is too long to load the page.
So I need load the whole page first without it. And on place of it show simple text "loading".
Next through javascript load and show it independently. However, these functions are 3.I need to do that with every function.
Specifically, detection of CPU / RAM / HDD state on remote servers.Because it now loads me the page for 10 seconds. This is how I would like to load whole web without this functions the first one, and after a few seconds load it, regardless of the page load.
I needed to keep these features in the same file too.
I hope you understand. Thank you for your help.
Try something like this: First, make your initial page with just HTML. Then have the page make a call with AJAX to a separate PHP file which will do the more complex steps that will take time.
Good to keep things faster from start
follow the steps
1) basic html having loading screen and divs in which other data will be placed
2) send parallel ajaxes to server to get different data in parts
3) on ajax response add data to those predefined divs
4) hide loading screen
Related
I have two pages html (upload page and insert page) with own javascript files. These two pages are the same with the javascript functions. The unique difference is that when I load the insert page it doesn't load from the server some information and when I load the upload page it ask to server some information. The others difference is the name of the button.
Is there a way in order to merge these two page and before to load the page to know its behavior (and to print the right button for instance and to set some global parameters in order to use properly the javascript function)? Maybe with a Ajax with the server? Or it is better to have the two page with own code that the difference is minimum?
The server is written in php.
For instance:
Upload page has green button and the insert page has blue button.
The javascript are more or less the same but in certain case there is some difference. This difference can be manage by a if:
if(flag===true) do X
else do Y
I have to thought to maintain separately the two page but the code is redundant.
So I have thought this approach:
I don't load the page (I use an spinner loop) and I ask to server some information
By this information I show the
button blue or green and set some variables
My answer is: It is better to maintain a redundant code or to use a different approach? And if it is better to use a difference approach which?
I am working on eCommerce website which is taking too much of time load whole webpage because of lots of images and data
How can I render some data like header first and then other like images, etc?
You can use ajax to load part of the website one by one. In your html code just keep whatever is necessary to show at first and then on the document being ready, call your ajax scripts to bring the data at runtime. This way user may not notice a lot of lag.
I need a javascript code which refresh an HTML DIV.
Currently, i use this:
$("#area").load("something.html #area > *");
It is good, it makes what i need, but i have to call it every 1 second and it takes about 4-5 seconds to reload my DIV. Is there any way to reload a DIV (the DIV contains php codes) fast?
The problem here relies on your PHP server, you can perform a .load call, a $.post call or an $.ajax call and I believe all will have the same result. The 4-5 seconds you are describing are mostly due to something in the server side script that's taking long to process. My suggestion would be to check the map.php file (as per your comment) and try to improve the performance of it.
On my website I have an option to display some data and also to download it in csv format. Some of the data is quite large (20,000 - 900,000 rows in SQL). When I display it on the site I use paging so that it quickly displays only x amount of rows at a time, however, the download link of course should and is downloading the entire report which can take several seconds to a couple of minutes depending on file size. I'm wondering if there is a way to create an interim pop-up or message in-line that says something like "Gathering Information..." where I could additionally put an animated gif so the user knows something is happening. Creating this shouldn't be an issue but I'm not sure if there is a way to trigger that to disappear once the download pop-up appears. The solutions I've seen on this site all suggest using a timer, but thats not an option in this case as the times will vary a lot.
I'm using classic ASP so would like to use either that or JavaScipt. I could additionally use flash if makes a difference.
I would probably wire up the "Gathering info..." message to be hidden upon receipt of a Comet style message from the server that could be sent out as soon as the file is ready to download on its end.
The gist of it is to use a cookie that you set using pure javascript or jquery cookies for ease of use. Then you send the cookie's name to your server, which sends an update for said cookie with the file once delivered.
Meanwhile you have some JS code that checks periodically for the cookie to see if its updated, and can then update the layout accordingly.
I ended up doing this a different way. On my site I have page we'll call "default.asp" on that page is a link to another asp wel'll call "download.asp". download.asp is where the code is to do the SQL query and create the report, which means this is where the wait comes in. After the report is prepared the popup to save, open, etc is displayed. What I ended up doing is creating a div that by default is hidden. When the download button is clicked the div is unhidden, then just before the popup is displayed I once again hide the div. Hopefully this can be of help to someone else as well.
I am a front-end developer who knows little JSP. I am working on a project that is building a CMS. This particular part I need advice is for slideshow data. In the JSP I am loading each slide and then injecting data with ajax. However it seems to be loading slowly, especially slideshows with more than 100 slides. It is also breaking with a lot of slides/HTML structure seems to break.
Each slide's data is loading with it's own endpoint by taking it's ID. In addition, each slide has a edit button that calls the slide's endpoint again to load a form, which also seems to load a bit slow. I was seeking what the best way to go about including this data with ajax. I was thinking something like infinite scroll - specifically http://www.responsivewebmobile.com/app/webroot/rwm_infinite_scroll/. However, what is the best way of organizing this and loading the data? Any advice is greatly appreciated.
Use Single page scrolling.We can load only one page at that time by loading data from Ajax dynamically.
Refer this
http://pagescroller.com/
http://alvarotrigo.com/fullPage/
While clicking page up or page down or slider ,we can load the content of next page using Ajax with id