How can i use $.post or $.get from subdomain

How can i use $.post or $.get from subdomain

Hello, i have a problem when using get or post from subdomain.

I have a file included in header: functions.js. in this file a have a function similar to:
  1. function popup(thevar,json){$.get("http://www.domain.com/ajax.display.php",{thevar:thevar,json:json},function(data){alert(data);});}
It works fine, but when i try to use this function from subdomain.domain.com it fails with no error.
Is there a way to resolve this so that i can call the function from any subomain?