0

I've a simple php page... a grid of perhaps 60 small images. I'm calling the PHP page via an AJAX call. On first load not all of the images appear, so invariably I have to run it a second time to load the rest of the images. I can right click on the icon place holder and click 'open in new tab' to view the image, but that's not really what I want!

Is there a way to make the AJAX call wait until the images have all loaded?

My current AJAX call is:

$.ajax(
            {
                type: "POST", 
                url: "ajax.php",
                data: (
                {
                    "type": "compareAssessmentsPies",
                    "yearGroup": yearGroup,
                    "subject": subject
                }), 

                success: function(response)
                {
                    $("#reply").html(response);
                }
            });

Thanks for any hints.

jack
  • 17
  • 5
  • What kind of response are you getting back? Is it a JSON or HTML? This [post](https://stackoverflow.com/q/4774746/1022914) might help. – Mikey May 30 '18 at 18:26
  • it's an HTML page... generated by PHP... basically loads 60 images into a grid depending on the parameters passed in yearGroup / subject – jack May 31 '18 at 04:57
  • You can use the `beforeSend: function() { //do your thing },` – executable Jun 11 '18 at 09:28

1 Answers1

0

It seems there is nothing wrong with the HTML / jQuery. It works fine from inside the firewall... but not from outside. The firewall must be restricting the number of requests for links in a certain time period. The company that provides it say there is no such restriction! Oh well!

jack
  • 17
  • 5