Increase A Number Over Time Without Refreshing The Page?
Sep 9, 2009using Javascript to increase a number over time without refreshing the page? I also need it to continually go up, and not start at 0 on every refresh.
View 12 Repliesusing Javascript to increase a number over time without refreshing the page? I also need it to continually go up, and not start at 0 on every refresh.
View 12 RepliesI'm trying to create a feature similar to facebooks "like" system.
I have a page with peoples posts in, and when someone clicks on "like", I want to first run the query to insert a new like into the database, then reload just the number of likes, without refreshing the entire page.
I know this way is harder but I want it to work without reloading everything. Here's what I have so far:
function for like (reverse engineered, might be completely wrong..)
function like(){
$('#postoptions').load('php_files/likecount.php');
}
postoptions.php
[Code]....
I know that at the moment there is no query to add an entry to the database when clicking on the like link, but I'm not too sure how to put it. I tried putting this:
$addLike = "INSERT INTOlike (username, postid) VALUES ('$username','$postid')";
$run = mysql_query($addLike) or die(mysql_error());
but because the posts are loaded with a while loop, clicking like on one made me like all of them on that page.
I though reloading the "likecount.php" page would reload the count for the page?
refreshing a page once,twice or so on every given time.. (refresh 1x/30 secs or 2x/40 secs)to make it clear:example i will input 100 on a textbox (so this is my given time) and i will set to refresh the page once,twice and so on in every given time(the 100 i have inputed)
View 2 Replies View RelatedI'm using some jQuery to work with the Last.FM API, and I'm stuck where I need to allow the user to run the JSON request a second time after the page loads (it loads once automatically when the page loads, the second time is when they push a button). What happens currently, is the JSON function is fed some default data when the page loads:
$('#graph').lastFM({
username: 'UserName',
from: 1254369600,
to: 1256184000,
apikey: 'myApiKeyHere',
onComplete: function(){
//Done
}});
The JSON function:
$.fn.lastFM = function(options) {
var defaults = {
username: 'Verdani',
apikey: 'e4f3bb251d13179bf7ce80a089fb3d0c',
onComplete: function(){}
},
settings = $.extend({}, defaults, options); .....
You might have noticed in the JSON, I write the URL the JSON is requesting to the console every time it runs. When I click this button, a new URL pops up in the console below the first one but only for a second, and then the page reloads and the original JSON request is called. It's this loop that I can't seem to break out of - why does re-calling the JSON refresh the page?
I have numerous checkboxes and when these are clicked upon I want to increase a number value further up the page. So as a checkbox is selected or deselected the relevant + or - 1 shall be applied to the number at the top of the page.
View 5 Replies View RelatedI am creating a progress bar. I simply want to increase the number when a button is clicked but the user stays on the same page. I've tried a few things and this is what I've got now.
<script>
progressPercent = 1;
function increaseProgress(){
progressPercent.innerHTML = (progressPercent+1)
}
</script>
<a href="#" onclick="increaseProgress()"><input type="submit" value="Start"/></a>
I have some code that I downloaded from the internet that shows you how to add a row to the bottom of your table by clicking a link. I have a PHP variable that counts the rows of the data that I currently have in my MySQL table and I want the variable to be grabbed by this javascript and every time I add a row it puts the number at the end of my name of my input statement (within the javascript) increased by 1.
Here's my php that gets my count of my rows
Code:
And here's the javascript to add a row
Code:
So to recap, I'm looking to somehow have the id="navpn1" and the name="navpn1" actually be navpn($CNTROWS +1) the first time I click the 'Add Row' link and then navpn($CNTROWS +2) and so on...
I am trying to use Javascript to change the CSS property fontSize to increase over a small amount of time. Here's the code:
Code:
function iscalled(id)
{
changesize(15,25,id)
[Code]....
I want to have the font size dynamically change, in the (id) object. I experimented with several versions of setTimeout, because it wasn't delaying at all. This script will run through setattr() only twice and doesn't modify the font size.
My firefox plugin called yslow that gives advice on speeding up loading times says: JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. the page load faster, move scripts to the bottom of the page if they are deferrable.
I always thought that js should be in the header. What do you think?
I am creating a contact us form and i want at the completition of the form to add a unique number so the customer can contact us.
I am using java and i decide to use the Server Time. I want to record the day,month,year,hour,minute,msec into 1 number with Java.
i've got a program that gets input from a user, and then stores it in a cookie. That bit is fine, what is a problem is that its just overwriting the data each time a new entry is made, i believed this to be something do do with it not being numbered entry's, so i added a number into the entry, but for some reason it wont add 1 to the number variable each time the function is called
<html>
<head>
<title>Grader 101</title>
[code]....
When a user clicks the "Close Panel Manager" link on page2.htm I would like page1.htm to be refreshed without losing the address in browser1/page1.htm. Page2.htm is a child popup from parent window page1.htm.
browser2/page2.htm
<A href="javascript:self.close();">Close Panel Manager</a>
browser1/page1.htm
Address: http://www.somewebsite.com?ID=24
Is it possible to refresh only part of a page rather than reload the
entire thing?
I have dropdown box that's populated from a database using ASP that I
need refreshed but I don't want to reload the entire page.
My URL is: http://localhost/testproject/product.html#catId=155I want to URL: http://localhost/testproject/product.html without refreshing the page.Is this possible using javascript Or jquery ?
View 3 Replies View Relatedhow to refresh a page when it is visited for the second or more times using javascript.
View 1 Replies View RelatedIm not sure if im going about this the right way but what I'm trying to achieve is to have my webpage seperated into two main div's.The first div contains a media player so it cant be refreshed or the media stops.The second div is used to view content.I've used innerHTML to change the content of the second div from links in the first.The problem is the URL displayed doesn't reflect the change in content of the second divI want to be able to load content into the second div using innerHTML while changing the URL so people can link directly to that content
View 5 Replies View RelatedMy URL is: http://localhost/testproject/product.html#catId=155I want to URL: http://localhost/testproject/product.html without refreshing the page.Is this possible using javascript/jquery or not ?
View 6 Replies View Relatedhere's a few lines of code I've got in a page that has a php database query in it and I want it to arrive at the anchor link I have called "bottom each time"
<script language="javascript">
function loadPage()
{
location.href = "http://www.mysite.com/help/chat/chat_window.php?theID=<?php echo $id; ?>";
}
</script>
</head>
<body bgcolor="#CCCCCC" onLoad="setTimeout('loadPage()',20000)">
The page has enough data to produce scrollbars. Is there something I'm doing wrong?
The user enters their info, the info is sent to the php page through ajax, the php checks if the input fields are empty and checks if the info is correct.If fields are empty or the info is wrong, it updates a div layer with an error message telling them what is wrong.
My problem though is if the user enters correct info. If the user enters correct info I want the main page (index.php) to be refreshed (This is the page with the original form on it).This is my java script:
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
[code]....
I've tried various things with the meta tag, including updating multiple parts of the page (using ID|<blah> instead of just a plain echo) and a couple other things. None of them will get the original page itself to reload.
I'm working on this system, where an admin can manage articles and stuff. The editing, adding and deleting of articles is done from within a Javascript popup. When the new article is added, the admin can hit a "close this window"-link to return to the admin-page, which contains a list of all articles.
This works fine, however, when returning to the list-page, the new article hasn't been added to the list, because there was no page refresh. Is there any way to invoke a page refresh from within the editing-popup?
I've been searching around for different ways to achieve this.
What I'm trying to do is to add a new DIV to my page without refreshing the actual page, and put that on a timer. Kind of a Live-Blog.[code]...
I'm loading another html file full of list items. What I would like to do is hide() the content right after it's loaded, and then fadeIn(0 each individual list item one at a time.
The problem is, it's loading all the list items at once. I don't know what to do. I could code the chain manually, but only if I knew the number of items in the list would never change. I'd really rather set it up to fadeIn any number of items dynamically.
Here's my code, which I know doesn't work, but maybe you could see what I am trying to do:
function loadContent(location) {
$('#content').load("assets/content/"+ location).hide();
var x = $('li#content').size();
var y = x - 1;
[Code].....
ave this form which gets created by pulling stock/products from a database using PHP and beside every product in the row is a little box for input and in there the user can input the quantity of the product they want. Sometimes only 2 products will be outputted and other times 10 or more.What I want to happen is when the user enters in lets say 3 for the quantity of a certain product I want to get a total for how much 3 of that product will cost so I just do 3 multiply by the cost (which I have from the database) and then display the total cost down under where the list of the available products are and I want all this to happen dynamically obviously not using PHP because I don't want the page to have to reload every time they enter in a new quantity.
I know how to display text and stuff in certain divs with certain ID's using Javascript but I just don't know how to keep track of a form and do what I want to do when the number of inputs in the form can range from 1 to 10 or more. Im thinking of some sort of counter which gives every input a different ID like add 1 at the end of the ID name of the input as the PHP script loops through the database query displaying the products but I still don't know how to go about the Javascript side of things
How to get a number to update realtime on a site? What I'm looking for is used on the following website:
New & Used Cars For Sale - Arnold Clark
The number with the top vehicle search update when a user makes any of the selections in the form. I think I know how to get the number to update via php and mysql queries on the db but how can I get the effect where the number rolls to the newly updated total?
I have been searching high and low on how to do this and I think I'm at a loss because I'm so unfamiliar with js and ajax.What I would like to do is have just a single div on a page refresh every 5-10 secs; the content of the div shows what users are logged on; the content is generated by a query on my db
<div id="players"><?php
$online_query = "SELECT user_log.user_id,user_log.ip,user_log.logged_in,user_log.logged_out,users.username,users.type_id FROM user_log LEFT JOIN users ON user_log.user_id=users.id WHERE user_log.logged_in IS NOT NULL AND user_log.logged_out IS NULL ORDER BY users.username";[code]....
almost all of the google results I got for refreshing a div were for updating dropdown boxes or dealt with some kind of page event...so now I'm at a loss on what else to look for..
Given some recent success on a simple form validation (mainly due to
the kind folks in this forum), I've tried to tackle something a bit
more difficult. I'm pulling data down from a database and populating a
simple table. I'd like the table to contain 10 entries per page and
have the option for the user to scroll through the pages of data
without having to go back to refresh the page (I've already pulled all
the info I need from the database). So, I've taken a stab at it and
this is probably not the best way to do it (so if you have a better
idea I'm open), but I think it will work. Right now I'm encountering
an 'Object Expected' error and I don't know how to interpret what it's
telling me. Code: