Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2008, 08:05 AM   PM User | #16
itsallkizza
Senior Coder

 
Join Date: Oct 2008
Location: Long Beach
Posts: 1,196
Thanks: 36
Thanked 164 Times in 164 Posts
itsallkizza will become famous soon enough
Quote:
Thanks but nothing gets displayed, blank page.
- What's a blank page? get_count.php? I can't help you with that one because I don't have access to your database - so I'd have no idea what you're doing wrong.

If your comments id is inserted via PHP on load, then do so, I don't see the problem:
Code:
function updateCounter()
	{
	var my_xmlhttputil = new XML_HTTP_Util();
	var handleCount = function(response)
		{
		document.getElementById("count").innerHTML = "Comment added ("+response.responseText+")";
		}
	my_xmlhttputil.sendRequest("get_count.php?id=<?php echo($_GET['id']) ?>",true,handleCount);
	}
__________________
Feel free to e-mail me if I forget to respond ;)
ohsosexybrit@gmail.com
itsallkizza is offline   Reply With Quote
Users who have thanked itsallkizza for this post:
student101 (12-24-2008)
Old 12-24-2008, 08:27 AM   PM User | #17
student101
Regular Coder

 
student101's Avatar
 
Join Date: Nov 2007
Posts: 610
Thanks: 80
Thanked 13 Times in 13 Posts
student101 is on a distinguished road
I didn't know that you could add the PHP values directly into the jscript like that, pretty cool.

Edit: It works once I add in the PHP

Only thing; In IE7 it shows once in FireFox it shows all the time after a page refresh/reload.
Any ideas there?
Edit: FIXED!!! Changed GET to POST

The code from the get_count.php is this;
PHP Code:
<?php
$sql 
"SELECT COUNT(*) AS count FROM comments WHERE id = '$_GET[id]'";
$result mysql_query($sql);
if(
$result){
  
$row mysql_fetch_row($result);
  
$count $row[0];
  echo 
$count;
} else{
  echo 
"Err";
}
?>
Edit:
This is so unbelievable THANK YOU!!!
WOW how cool is this!
__________________
Thanks for your support!
Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

Give thanks & resolve when done :thumbsup:

Last edited by student101; 12-24-2008 at 08:40 AM..
student101 is offline   Reply With Quote
Old 12-24-2008, 02:43 PM   PM User | #18
itsallkizza
Senior Coder

 
Join Date: Oct 2008
Location: Long Beach
Posts: 1,196
Thanks: 36
Thanked 164 Times in 164 Posts
itsallkizza will become famous soon enough
Glad I could help
__________________
Feel free to e-mail me if I forget to respond ;)
ohsosexybrit@gmail.com
itsallkizza is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:10 PM.


Advertisement
Log in to turn off these ads.