McPete. Posted May 12, 2009 Share Posted May 12, 2009 Hi, I'm trying to create an AJAX script which reads a text string from a php script. I've managed to do this and it works fine. Problem is, when the php script is ran, it's supposed to add a record to a database. If I run the script through a browser it does this, but when called from the ajax script it doesn't. I've managed to get this to work before when calling xml, but as I'm doing it a different way as it's calling text I'm a bit stuck! I've attached the code I'm using at the moment. If anyone has any idea's or suggestions I'd be eternally grateful Thanks, Pete. request = false; if (window.XMLHttpRequest) { request=new XMLHttpRequest(); } else if (window.ActiveXObject) { request= new ActiveXObject("Microsoft.XMLHTTP"); } else alert("your browser does not support Ajax"); if(request!=false) { request.onreadystatechange=Resp; request.open("GET",url,true); request.send(null); } } } function Resp() { var Text; if (request.readyState==4) { if(request.status==200) { respon=request.responseText; showBasket(respon); } } } Link to comment https://forums.phpfreaks.com/topic/157845-ajax-calling-php-script/ Share on other sites More sharing options...
justinh Posted May 12, 2009 Share Posted May 12, 2009 What is assigned to the 'url' variable? Link to comment https://forums.phpfreaks.com/topic/157845-ajax-calling-php-script/#findComment-832790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.