Take the 2-minute tour ×

hey all, i have an apache server on port 8080 and apache tomcat on 8181.

i want to call a command in apache from tomcat. this command is a php script found on the apache server port 8080.

i use jquery inside a javascript function on tomcat server, using $.ajax. sthg like:

function fct()
    type: "GET",
        url: pathofApache8080 + "script.php",
        cache: false,
      dataType: "xml",

success: function(xml) { }

}); }

now currently this works except that the xml that the php file should return is not being returned. i thought it considers it as cross domain issue, i installed jquery plugin for cross domain found at this site: http://github.com/jamespadolsey/jQuery-Plugins/blob/master/cross-domain-ajax/jquery.xdomainajax.js

this plugin works fine if i try it for lets say google.com, or any other site... it just doesnt work when i call from my apache tomact to apache which are on same server different ports... is there anything as cross port issue? or is it a configuration in php.ini file that i should modify?

any suggestions? thanks a lot:)

share|improve this question
how do you call your php application? –  ariefbayu Oct 5 '10 at 20:53
inside the $.ajax, i put url:pathofapche8080server+"phpscript.php". –  shadesco Oct 5 '10 at 20:58
Do you get an error message when you add an error handler like error: function(r, s, e) { alert(s + " " +((r && r.status) ? r.status : "unknown")); } to the options you pass to $.ajax() ? –  VolkerK Oct 5 '10 at 21:55
why don't you use a simple proxy php file to handle this? a .php script on the same domain fetching all data from the script on the same server/diff port and sending that data back to the client. –  andreas Oct 7 '10 at 1:14
add comment

1 Answer

up vote 0 down vote accepted

I tried this, sometimes it works, sometimes not. Got no idea why, sorry.

But: The plugin you found there doesn't perform magic. It will fetch the external ressource using jsonp. The adress will be sended to a proxy(query.yahooapis.com) , which requests the URL and sends it back.

So why don't you create your own proxy. All you need is a PHP-Skript on host:8080 which receives the adress host:8181, requests the adress and print's the response. If you do this, you dont have to workaround with jsonp, because it's no same-origin-issue and security also should'nt be a problem, as long you have control over the requested ressource.

share|improve this answer
add comment

Your Answer


