Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Simple Click Tracking

    This is what I'm trying to do..

    I have an HTML file example

    <a href="#1"> Test Click </a>
    <a href="#2"> Test Click </a>

    Nothing in the html file can be change..
    What I want to do is track the clicks using jquery (ajax) and pass the url to php

    The txt file would say something like
    This link what clicked this many times but this ip address

    I have some coding but can't get it to pass to php

    This is what I have
    <script src="http://code.jquery.com/jquery-1.4.4.js"></script>


    $("a").live("click", function(){

    var href = this.getAttribute('href');

    type: "POST",
    url: "stat.php",
    data: "name=John&location=Boston",
    success: function(msg){
    alert( "Data Saved: " + href);




    the data is not passing to php but can het the url to display in the alert box.

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    London, UK
    Thanked 110 Times in 109 Posts
    What does Firebug say? Can you see the AJAX call being made in the console to the PHP page in question?


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts