0

i have a gallery page it is working properly that i want but after using ajax XMLHttpRequest object, image caption and slideshow not working, basically css and javascript file not working fine.

  <script>
        function filterSelection(data) {
            var xmlhttp;
            if (window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
            } else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                    // change content from div
                    document.getElementById("imageContainer").innerHTML = xmlhttp.responseText;
                }
            };
            xmlhttp.open("GET", "get.php?menu_title=" + data, true);
            xmlhttp.send();
        }
    </script>
6
  • 1
    What error did you get? give more description. We can not understand by looking your js code. Commented Aug 22, 2018 at 6:17
  • What exactly do you need? Unable to load data? Commented Aug 22, 2018 at 6:18
  • i have gallery page but onclick image the caption and slideshow not working Commented Aug 22, 2018 at 6:21
  • not working fine unfortunately that doesn't say much - you'll need to expand your description of the error - look in the browser developer console, what errors if any appear there. chances are you are overwriting something important when you replace the innerHTML of the element with id=imageContainer Commented Aug 22, 2018 at 6:24
  • gallery section have button for filter the photos according to button click, so the images onclick will show the image with caption, but after using this ajax code its not working Commented Aug 22, 2018 at 6:32

1 Answer 1

1

Not sure why the CSS would not work, but in regards to the JavaScript it is most likely because after you nuke the contents with innerHTML you would have to re-initialise your JavaScript gallery with your new HTML...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.