[jQuery] clickCount..
[jQuery] clickCount..
Okej,
the clickCount routine works just fine, still trying to learn jQuery,
wich I believe rocks my world in trying to understand Javascript.
I can handle php, mysql rookielike, but makes my wish happen.. ;o)
But javascript, hmm, more than rookie.. still happy though.
Here I go:
<html>
<head>
<title>
jQuery clickCount
</title>
<link rel="stylesheet" type="text/css" media="screen"
href="form.css">
<script type="text/javascript" src="../js/jquery-latest.pack.js"></
script>
<script type="text/javascript">
<!--
$(document).ready(
function(){
$("div.popBlur", this).click(
function(){
var linkID = $("a", this).attr("id");
alert("About to post: " + linkID);
$.post("./dbUpdater.php",
{ name: "JohnDoe", id: linkID },
function(data){
// HEEEELP ! ?
$("span#"+linkID).append(data);
alert("Value: " + data + ",\nwas successfully posted.");
}
);
return false;
}
);
}
);
// -->
</script>
</head>
<body>
<div>
<div class="popBlur">
<a id="1" href="http://google.com" target="_blank">
divClick 1
</a>
<span id="1"> 27</span>
</div>
<div class="popBlur">
<a id="2" href="http://yahoo.com" target="_blank">
divClick 2
</a>
<span> 10</span>
</div>
<div>
<a id="3" href="http://metacrawler.com">
noPopUnder
</a>
<span> 3</span>
</div>
</div>
</body>
</html>
What happens here is simple, click a link within the class 'popBlur',
and the jQuery sends some parameters to --> dbUpdate.php, which
returns the new value of (totalClicks) successfully. Very simple. I
like it simple.
What I want to happen next, is: to update the <span> just after the
clicked link, with the new value retrieved from the database. Been
trying too long now, about 5-million different constellations, too
hungry, so now I ask the happy Professionals. HOW?
Oh yes, i'll be in the kitchen for a while now, so SCREAM OUT LOUD
your reply, and yes, you may also simplify my code above in your way..
just want to learn how jQuery operates. And different solutions make
me more experienced.
../peace