1

I have one php file which fetch the data and display in html with jquery slider which is working fine in directly run demo.php.

I have issue with when i fetch this file data (demo.php) then display the HTML in new page (script.html) but slider effect and other jquery event not working in this page.

This is my code which is include in new file (script.html).

<div id="widget-frame"></div>
<script>
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("widget-frame").innerHTML =
      this.responseText;
    }
  };
  xhttp.open("GET", "demo.php", true);
  xhttp.send();

</script>

Actually i need to make one type of widget so user copy the above code and place in his/her project file then appear the demo.php file content in particular section.

So please let me know how i can load the jquery in it.

I used the iframe :

<iframe src="demo.php" frameborder="0" style="border:0; width:100%; min-height: 350px; overflow:hidden;" scrolling="no"></iframe>

iframe works fine but it's not working properly in iphone so i need to use XMLHttpRequest method.

Thanks in advance.

  • Is the problem that the ` – Barmar Aug 04 '18 at 06:13
  • responseText return the html data with js and css and it's return fine but not working jquery effects. – InSystem Grp Aug 04 '18 at 06:16
  • We need to fetch demo.php all content with working jquery and slider effect without load any jquery file in script.html file. – InSystem Grp Aug 04 '18 at 06:18
  • Where are you calling the jQuery effect methods? You have to do it after you load the HTML. – Barmar Aug 04 '18 at 06:19
  • Actually in demo.php file i used the swiper slider and load this jquery into this file and when i run demo.php file then works fine but when i fetch the demo.php file content in script.html file then swiper slider stop working in script.html file. So please let me know how can i load this jquery file without load swiper slider jquery in script.html file. – InSystem Grp Aug 04 '18 at 06:22
  • try to alert your response text with alert(this.responseText) and check you are getting propper response or not – user3782114 Aug 04 '18 at 07:02
  • Yes, I am getting proper response with html and js file but not work swiper slider still. – InSystem Grp Aug 04 '18 at 08:43
  • Please anyone help i am stuck with this problem – InSystem Grp Aug 04 '18 at 11:27

0 Answers0