javascript - Ajax load after loader -


i have function loads specific content of outer html page , loader. want load content right after showing loader 1.5 seconds. when refresh page loader loads nothing happens , need again click on button load it. code here:

   <script> //  css loaded content $("<link/>", {    rel: "stylesheet",    type: "text/css",    href: "usercss(english).css" }).appendto("head"); // loaded content button $(document).ready(function(){     $(".searchbutton").click(function(){         $("#coursecontent").load("userpage.html #content");     }); });   var myvar;  function myfunction() {     myvar = settimeout(showpage, 1500); }  function showpage() {   document.getelementbyid("loader").style.display = "none";   document.getelementbyid("coursecontent").style.display = "block"; }  </script> 

and here html page body.

<body onload="myfunction()" style="margin:0;">       <div id="page">             <div id="head">               <a href= "user.php"><img id = "erulex"src="logo.png" alt="logo" style="width:300px;height:59px;"></a>                <input id="search" placeholder="search..." type="text" name="search">                <a class="searchbutton" href="#"></a>                <a class="messagebutton" href="#"></a>                <a class="addbutton" href="#"></a>                <a class="notificationbutton" href="#"></a>                <a class="outbutton" href="logout.php"></a>             </div>             <div id="body">             <div id="loader"></div>              <div style="display:none;" id="coursecontent" class="animate-bottom" >             </div>                 <ul id="naviup">                   <li id="u"><a class="active" href="#home">home</a></li>                   <li id="u"><a class="active" href="#home">profile</a></li>                   <li id="u"><a href="#news">forum</a></li>                   <li id="u"><a href="#contact">store</a></li>                   <li id="u"><a href="#about">help center</a></li>                   <li id="u"><a href="#about">friends</a></li>                 </ul>             </div>             <div id="footer">                 <ul id="navbar">                     <li id ="d" ><a href="#home">about</a></li>                     <li id ="d" ><a href="#terms">terms of use</a></li>                     <li id ="d" ><a href="#contact">help & support</a></li>                     <li id ="d" ><a href="#private">privacy policy</a></li>                     <li id ="d" ><a href="#contact">contact us</a></li>                 </ul>             </div>       </div>   </body> 

could please solve it. not figure out. appreciated.

in onload function load data , , on click of button show div

<script> //  css loaded content $("<link/>", {    rel: "stylesheet",    type: "text/css",    href: "usercss(english).css" }).appendto("head"); // loaded content button $(document).ready(function(){     $(".searchbutton").click(function(){         document.getelementbyid("coursecontent").style.display = "block";     }); });   var myvar;  function myfunction() {     myvar = settimeout(showpage, 1500); }  function showpage() {   document.getelementbyid("loader").style.display = "none";     $("#coursecontent").load("userpage.html #content"); } 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -