0

Im trying to build a counter for my links in many website I have. so every click on my links on other websites, my database will count them..

(every website is in another server..)

I tried to build some script in Jquery on every page that I want to make this happened:

$(document).ready(function() {

    attach();
});


function attach() {

    var name;
    var classCounter = $('.counterStrike');

    classCounter.bind('click', function() {

        var name = $(this).attr('name');

        var url = "http://XXXXX.######.XX/XXX/XXXX/Handler/Handler.aspx";
        var op = "1";
        var fromLocation;

        $.post(url, {
            name: name,
            op: op
        }, function(result) {
            alert(1);
            $("#result").html(result);

        });


    });


}

this worked fine in the same server, so I guess I have some cross browser problem ? right? is there a way to manipulate it ?

Thanks!

thormayer
  • 1,070
  • 5
  • 27
  • 47

2 Answers2

2

You can use jsonp. It's used for cross-domain requests

Kirill Ivlev
  • 11,870
  • 5
  • 25
  • 30
-1

Maybe you can add for example new HttpHandler on your side that will make post from your server to remote and get data ,

then post via ajax to your httphandler like to a kind of proxy ...

StringBuilder
  • 1,599
  • 3
  • 32
  • 51