I've got a JQuery function using getJSON to bring some userifo. It's like that:
$.getJSON("http://server.com/?apirequested=userinfo", function(data){
...
...
});
This works fine, but I'm trying to change it to use same code for several servers using relatives url's.
I'm trying several things like:
$.getJSON($(location).attr('hostname')+"/?apirequested=userinfo" ...
or
$.getJSON($(location).attr('protocol')+$(location).attr('hostname')+"/?apirequested=userinfo",
or
$.getJSON(location.hostame+"/?apirequested=userinfo" ...
But it does not work. What am I doing wrong?
Any suggestions?
Thanks in advance for your time.