Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 3 of 3
-
03-10-2016, 09:44 AM #1New to the CF scene
- Join Date
- Nov 2015
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
ajaxStart() and ajaxStop dont work
Hi everyone
I have the following code which tries to use the ajaxStart and ajaxStop functions and they dont work, any idea ???
index.html
style.cssCode:<html> <head> <title>in</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> </head> <body> <div class="loader"> <img id="loaderImg" src="loading.gif" alt=""/> <button onclick="unBlockEverything()">Hide</button> </div> <button onclick="blockEverything()">Show</button> </body> <script src="update.js" type="text/javascript"></script> </html>
Code:.body{ position: relative; } .loader{ position: fixed; height: 100%; width: 100%; background-color: rgba(0,0,0,0.725); z-index: 1000; } #loaderImg{ position: fixed; top: 50%; left: 50%; margin-top: -100px; margin-left: -150px; }
update.js
Any help?Code:$(document).ready(function () { alert("hi"); $('.loader').hide(); $('.loader') .ajaxStart(function () { console.log("show1"); $(this).show(); }) .ajaxStop(function () { $(this).hide(); console.log("HIDE2"); }) ; }); function blockEverything(){ $('#loader').ajaxStart(); console.log("show"); } function unBlockEverything(){ $('#loader').ajaxStop(); console.log("hide"); }
Thank you in advance
-
03-11-2016, 10:31 AM #2New to the CF scene
- Join Date
- Nov 2015
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Mainly my problem is that i need to run in JavaScript long duration while loop in the background, without freezing the entire web page. I found the ajaxStart which doesnot work in any browser as is presented in the provided code above.
Any idea?
-
03-11-2016, 02:48 PM #3Regular Coder
- Join Date
- Feb 2016
- Location
- Keene, NH
- Posts
- 311
- Thanks
- 0
- Thanked 42 Times in 40 Posts
Your code is gibberish (mind you I'd say that just because it's jQuery) -- the biggest problem I'm seeing is unterminated strings... I don't know if the forum software screwed with it, but this:
You don't see the problem there?Code:.ajaxStart(function () { console.log("show1 $(this).show(); })From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
http://www.cutcodedown.com



Reply With Quote
