|
-
Jan 27th, 2012, 08:51 PM
#1
Thread Starter
Fanatic Member
Run php code onclick?
Hi guys, so im using the current code to refresh a div tag every 10 seconds, the code im using is...
Code:
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_tweets').load('getnotifications.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds</script>
<body>
</head>
<body>
<script type="text/javascript">
that code works and refreshes my div tag, now im trying to make it so when a url is clicked it will run php code without refrshing the entire page, 9the php code updates my database)
The code im using is
Code:
function doit()
{
$.get("updatenotifications.php");
return false; }
</script>
however, it seems when ever it refreshes or the page gets manually refreshed, it will run the function doit() and update my db..
Is there a way i can make it only run the function onclick ? rather than whn ever its refreshed?
Thanks,
Jamie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|