PHP没有使用Cordova / Phonegap在Xcode模拟器上执行

I am creating a non-native iOS application in an HTML5/Javascript/CSS3 implementation. I have an external PHP file on my localhost and am trying to communicate with it using jQuery and AJAX.

Everything works fine if I make the request to the PHP file in my browser and I get the desired response, so there is no problem code-wise.

However when running it in Xcode's simulator, the PHP doesn't execute and I just receive the whole PHP script as the response. I don't know why it isn't executing and I've been stuck on the problem for ages, Please can anyone help?

I have already tried putting header("access-control-allow-origin: *"); at the top of the php page but I am still getting no result.

Would appreciate any suggestions!