Link to home
Start Free TrialLog in
Avatar of jblayney
jblayneyFlag for Canada

asked on

ajax to record click

Hello,

I am trying to record every click into a database, i am getting no errors, but nothing is recorded either.

here is my jquery

<a href='/downloadocs/newdoc.txt_2017-11-01-42.zip' name='file8'>Full Report</a>

<script type="text/JavaScript">
					$(document).ready(function(){
						$("[name=file8]").click(function(){
						$("[name=store]").load("/record.php?thefile=8");

						});
					});
			</script>

Open in new window


my record.php

$thefile = $_GET['thefile'];

$thequerysql ="
							INSERT INTO  tracking 
							(documents_doc) 
							VALUES (".$thefile.")";
					 
					 		if (!mysqli_query($link, $thequerysql))
							{
							   $msg = ("Error description: " . mysqli_error($link));
							   echo $msg; 
							   exit;
							}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Peos John
Peos John
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jblayney

ASKER

Thank you, your both right.

because it is wordpress, i had to use the full path in both my php connection and my jquery..

/wp-content/themes/...