adam291086 Posted June 22, 2008 Share Posted June 22, 2008 I got some ajax script of another forum and i am trying to implement it into my script. Here is the ajax part function createRequestObject() { var request_o; //declare the variable to hold the object. var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet Explorer"){ /* Create the object using MSIE's method */ request_o = new ActiveXObject("Microsoft.XMLHTTP"); }else{ /* Create the object using other browser's method */ request_o = new XMLHttpRequest(); } return request_o; //return the object } /* Function called to handle the list that was returned from the internal_request.php file.. */ function handleThoughts(){ /* Make sure that the transaction has finished. The XMLHttpRequest object has a property called readyState with several states: 0: Uninitialized 1: Loading 2: Loaded 3: Interactive 4: Finished */ try { if(http.readyState == 4){ //Finished loading the response /* We have got the response from the server-side script, let's see just what it was. using the responseText property of the XMLHttpRequest object. */ var response = http.responseText; //alert(response); if(response!="ok") { alert("Please select another username!"); } } } catch(Exception) { } } i then have a javascript function that uses the above functions to run my php script function update_database(el) { var height; var width; var top; var left; var Div_name; var Border; var Position; var Background; var Cursor; height = el.style.height; alert(height); if(height == '') { height = '100px'; } width = el.style.width; if(width == '') { width = '100px'; } top = el.style.top; if(top == '') { top = '0px'; } left = el.style.left; if(left == '') { left = '0px'; } Div_name = el.id; Border = el.style.border; Position = el.style.position; Background = el.style.background-color; Cursor = el.style.cursor; var http = createRequestObject(); http.open('get', 'update.php?height=' + height + '?width'+width + '?top'+top + '?left'+left + '?Div_name'+Div_name + '?Border'+Border + '?Position'+Position + '?Background'+Background + '?Cursor'+Cursor); http.send(null); } this is the php script <?php include('config.php'); $left = $_GET["left"]; $top = $_GET["top"]; $height = $_GET["height"]; $width = $_GET["width"]; $Position = $_GET["Position"]; $Background = $_GET["Background"]; $Cursor = $_GET["Cursor"]; $Border = $_GET["Border"]; $div_name = $_GET["Div_Name"]; $conn; mysql_query("UPDATE Admin_Page_Style SET Style_Left = '$left',Style_Top = '$top',Style_Height = '$height',Style_Width = '$width',Style_Position = '$Position',Style_bgcolor = '$Background',Style_Cusor = '$Cursor',Border = '$Border',div_name = '$div_name', WHERE div_name = 'div3'"); ?> but my database dosn't update. What am i doing wrong, Link to comment https://forums.phpfreaks.com/topic/111323-solved-new-to-ajax/ Share on other sites More sharing options...
Darklink Posted June 22, 2008 Share Posted June 22, 2008 You haven't made any of the changes I have told you throughout this entire thread. Link to comment https://forums.phpfreaks.com/topic/111323-solved-new-to-ajax/#findComment-571685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.