views:

189

answers:

2

Hey guys. I was told that the only trick to sending data to a external server (i.e x-domain) is to use getJSON. Well my problem is that the data I am sending exceeds the getJSON data limit. I am tracking mouse movements on a screen for analytics.

Another option is I could also send a little data at a time. probably every time the mouse moves. but that seems as if it would slow things down.

I could setup a proxy server.

My question is which would be better? Setting up a proxy server ? or Just sending bits of information via javascript or JQUERY. What do the professionals use (Google and other company's that build mash-ups that send a lot of data to x-domain sites.)

I need to know the best practices. Thanx!!

Also the data is put into JSON.

A: 

Take a look at this: http://docs.jquery.com/Ajax/jQuery.post

Using the get method is dependant on the length of the url, as it appends a ?name=value&name2=value2&... to the url. Instead, you need to use the post method.

$.post(url, {x:0,y:50}, function(data)
{
    //data contains the json object retrieved.
    alert(data.status);
},"json");
Eric
So it is possible to use the $.post() for cross domain data sending ??
numerical25
I'm not entirely sure. I didn't register that you were doing cross-domain.
Eric
A: 

Best practice just as a general networking application would be to set a certain buffer size and write your events into that buffer. Once the buffer limit has been reached swap it with a new empty buffer to receive events and send the full buffer out over the wire.

joshperry