Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is there a way to get the percentage of page loaded after a user clicks a link or a submit button on a form?
When the user submits a form, an overlay is presented while the next page loads next. This can take a few seconds or minutes while the info is being processed. Is there a way to get the progress of the of the loading of the page being redirected to?.
I'm assuming ajax is used.
The most basic form of progress you can get in a webpage is via the onreadystatechange event. The ajax response object will have a code telling you the load status of the page. More info here.
This isn't really helpful though, as the bulk of the operation will occur on readystate == 3, so if you show 20% * readystate you'll almost immediately get to 80% and then have to wait for the page to actually get here.
A better (and slightly more complicated way), is to set an http header called "Content-Length" to the total amount of bytes being sent, and then use the xhr onProgress event. in this event, your data object will have two properties: total, which is the amount of bytes set in the header; and loaded, or the amount of bytes received. from then on it's quite simple to make a progress indicator. More info here
if you want help with your specific code, upload it and I'll be happy to edit this answer and add real code that fits in with yours.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have recently made a webpage that needs to refresh every few seconds, but in some cases; navigation or other things may be interrupted by the constant refreshing.
I am seeking a way to enable/disable the auto-refresh preferably using JavaScript.
This way, I can click a button on my webpage to have auto-refreshing set to on and another button to turn it off.
Thanks!
You'd be better off using AJAX and jQuery for this. It's actually very simple.
setInterval(function(){
$('#my_div').load('/path/to/server/source');
}, 2000)
This would re-load the div with the ID "my_div" every two seconds and refresh it with the specified path. .load() is short for $.ajax.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I shouldnt even be in HTML/CSS, but here I am trying to incorporate a php modal contact form into my site...
I'm trying to get all of a demo form's functionality into my footer page (and then I'll restyle everything.)
http://danux.me/sections/footer_modal.html
I'm trying to get "email me" to fire ideally, but am settling now for just the Demo button to fire the popup form.
I also uploaded the demo form I'm pulling code from, just to make sure it works on my site. (It does.)
http://danux.me/contact/
Any guesses as to what I'm doing wrong?
Your first link is in a different folder, yet the url for $.get points to the same relative file. Which isn't there.
So in contact.js needs to have
$.get("../contact/data/contact.php", function(data){
I obviously cant test this. And it looks like there is some redesign in folderstructure coming up.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I wish to get the contents of a web page that requires me to be logged in (and one that I do not have control over: e.g. Twitter or Facebook), for example I can have Chrome running and I can see Ajax updating the page updating, but I want to periodically get the contents of this page and somehow save it. I don't mind leaving a computer running to achieve this...
You can use any http software to achieve this (like curl). Depending on the site it will take some investigation of how requests are made, in what order, the post data, the encryption, the user agent, cookies, headers, etc. etc.
It could take some time to find the right recipe.
Generally these sites don't want you to do this though, so don't be surprised when you run up against captcha or other clever methods from preventing exactly what you're trying to do.
Chances are, if you have to ask, you won't get in. But have fun.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Hi and thanks for your time. I have an landing page selling a product (Wordpress Course, for example). When someone clicks on the buy button, he´s redirected to a payment service (paypal like).
What i need from you is a simple thing: an idea (or even a clue) on how to count the number of times the submit button (buy button) is clicked.
I can easily imagine how to count page views with PHP, but is it possible to redirect him to the third party and at the same time reload the initial landing page, to execute my SQL Update Query to count one click, or something like this?
You could use Ajax.
When the button is clicked send an AJAX request to a php page just like others have suggested. However since it is asynchronous, your users won't even notice it.
In terms of code you could just send the ajax request, then redirect to the payment page. Easy and done.
EDIT---
To get info on ajax:
http://api.jquery.com/jQuery.ajax/
http://www.w3schools.com/ajax/
Have the link go to a page on your end, i.e. click.php, that does the SQL update, then redirects to the actual URL you wanted them to wind up on.
Or, just create a bit.ly (or any other URL shortener) URL and use their built-in click tracking for free.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is there a way to make a non-refreshing menu like facebook with javascript or something?.
I want to put my radio player in a non-refreshing div or section. i've been looking but nothing. Only i got is load jquery function but that's not what i want. I want url changes.
Here there's a example website. It has a non-refreshing section on top and bottom. http://enladisco.com
Saludos and forgive my english.
The simple method.
<header>
My persistent header
</header>
<div>
<iframe src="actualPageContent.html"></iframe>
</div>
When links are clicked, the browser does navigation inside the frame. The downside is that the address bar doesn't change.
Use the script from this answer to dynamically load content into your main section, while leaving the header intact, and changing URLs in the browser. The back button also works here.
Go with this if you can.
That page is actually loading the content via ajax with $.ajax (which is what $.load will call) and not refreshing the page. check Modify the URL without reloading the page to see how to modify the URL without triggering a refresh.