AJAX To Call and Run PHP Script

JennyUM

New Member
I have a working PHP script on my server and a HTML page with JavaScript and AJAX which I would like to call and run the PHP script. However, the AJAX responseText is displaying all the PHP code rather than running it. What do I need to do to only get the results of the PHP? Other examples I looked at used the responseText and it seemed to work out well, but not for me :(Thanks,elshaeMy AJAX code is below...my PHP works fine, it has been tested :)\[code\] function ahah(url) { //document.getElementById(target).innerHTML = ' Fetching data...'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function() {ahahDone(url);}; req.open("GET", url, true); req.send(""); } } function ahahDone(url) { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200) { // only if "OK" var div = document.createElement('DIV'); div.innerHTML = req.responseText; document.getElementById('chicken_contentDiv').appendChild(div); } else { " <div> AHAH Error:\n"+ req.status + "\n" +req.statusText + "</div>"; } } } function load(name) { ahah(name); return false; }<div> + load('./getFiles.php') + </div> //called in a div\[/code\]Ok here is the new code://Some stuff happens here, IMO think it's irrelevant to this issue...\[code\]//This is where the AJAX/JQuery calls the phpvar info = new OpenLayers.Control.WMSGetFeatureInfo({ url: 'http://localhost:8080/geoserver/wms', title: 'Identify features by clicking', queryVisible: true, eventListeners: { getfeatureinfo: function(event){ map.addPopup( new OpenLayers.Popup.AnchoredBubble( "chicken", map.getLonLatFromPixel(event.xy), null, event.text + '<div> Hello Tibet :)</div>' + $('#chicken_contentDiv').load('http://localhost/mapScripts/getFiles.php'), //have also tried localhost:80, no diff null, true )); } } }); map.addControl(info); info.activate(); });\[/code\]
 
Back
Top