By the way you phrased that question, I don't think this is an acceptable solution. Right?
There is one very easy way to get around the Javascript security limitations, which is to serve the required page from the same domain. A simple script:
Code:
<?php include("http://www.othersite.com/calculateprices.php"); ?>
You can then access the page using an XMLHttpRequest.
Code:
function getHttpRequest() {
if(typeof ActiveXObject == "undefined" && typeof XMLHttpRequest == "undefined") return null;
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
catch (e) {
try xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
catch (E) xmlhttp = false;
}
@else xmlhttp = null;
@end @*/
if (xmlhttp == null && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = null;
}
}
return xmlhttp;
}
// ...
function getPHPOutput() {
(var xh = getHttpRequest()) == null ? return false : 0;
xh.open("GET", "getpage.php", false);
xh.send(null);
if(xh.readyState != 4) return false;
else return xh.responseText;
}
Bookmarks