PHP - Php Jquery Call Not Finishing Ajax-success: Php Create File And Email
Hello all I have a php and jquery/ajax call I am using to create a file/send an email. I get all the contents from my textboxes but I want a message to display on the screen afterwards being success or fail. In my .ajax call My call is exiting right before the ‘success:’ part. Why is my call not succeeding? Any tips/help will be appreciated Thank you Html page just a form with a submit button $(document).ready(function () { var form = $("#formData"); $(form).on("submit", function (event) { event.preventDefault(); $.ajax({ type: "post", url: "file.php", data: $(this).serialize(), beforeSend: function () { $("#status").html('<span style="color:red;">Loading everything actually creating a .TXT file of contents...</span>') //--works }, success: function (data) { var responseMsgType = "alert-" + data.type; var responseMsgText = data.message; // message below var alertBox = '<div class="alert ' + responseMsgType + ' alert-dismissable"><button type="button" class="close" ' + 'data-dismiss="alert" aria-hidden="true">×</button>' + responseMsgText + '</div>'; if (responseMsgType && responseMsgText) { $(form).find(".successArea").html(alertBox); $(form)[0].reset(); } } }); return false; }); <?php $controls = array('txtName' => 'Name', 'txtEmail' => 'Email', 'txtSubject' => 'Subject', 'txtMessage' => 'Message'); try { if(count($_POST)==0) { throw new \Exception ('Contact Form Message is empty'); } $headers = array('Content-Type: text/plain; charset="UTF-8";', 'From: ' . $email, 'Reply-To: ' . $email, 'Return-Path: ' .$email); $emailMessage = "You have a new message from your contact form" . PHP_EOL; $emailMessage .= "-------------------------------------------------------" . PHP_EOL; foreach($_POST as $key => $value){ if(isset($controls[$key])) { $emailMessage .= "$controls[$key]: $value". PHP_EOL; } } $mailMsg = "email6.txt"; if(file_exists($filename) == false) { $fh = fopen($mailMsg, "w"); fwrite($fh, $headers); fwrite($fh, $emailMessage); fclose($fh); } else { $fhexists = fopen($filename, "a"); fwrite($fhexists, $content); fclose($fhexists); } $responseMessage = array("type" => "success", "message" => $successMessage); } catch (\Exception $ex) { $responseMessage = array("type" => "errorM", "message" => $errorMessage); } if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $encodedJSON = json_encode($responseMessage); header("Content-Type: application/json"); echo $encodedJSON; } else { echo $responseMessage["message"]; }
Similar TutorialsHello, I decided I would make my websites load less by implementing ajax/jQuery.. I however stumbled upon a problem.. This is the code I use to direct myself to the registeration page... Code: [Select] function register(){ $.ajax({ type: "POST", url: "user/registerConfirm.php", data: "regUsername=" + document.getElementById("regUsername").value + "®Password=" + document.getElementById("regPassword").value + "&myPassCheck=" + document.getElementById("myPassCheck").value + "®Email=" + document.getElementById("regEmail").value, success: function(html){ $('#response').html(html); alert("success..."); }, complete: function(html){ $('#response').html(html); alert("completed.."); } }); } When running - it shows me the "alert("completed..");", and in fact- the code used to insert the user in my database is working. However, I never seem to get the 'html' variable that they use in tutorials I found. (meaning I can't show some sort of response) The php code used: Code: [Select] <?php session_start(); ob_start(); require("../widgets/functions.php"); connectToDB(); // Check email if (!filter_var(clean($_POST['regEmail']), FILTER_VALIDATE_EMAIL)) { $error = 'Invalid email!'; } else { if ( clean($_POST['regPassword']) == clean($_POST['myPassCheck']) && clean($_POST['regPassword']) != NULL && clean($_POST['regUsername']) != NULL && clean($_POST['regEmail']) != NULL ) // Register can be allowed { // Check if their already is a user with the same name.. $sql="SELECT * FROM `users` WHERE username='".clean(trim($_POST['regUsername']))."'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); if($count==1){ // Their was already a user with this name! $error = 'Registration failed - username already taken..'; } else if ( $count == 0 ){ // Registration allowed, no user found with the same name // Encrypt password $encryptPass = md5($_POST['regPassword']); $subject = "Confirmation registration"; $message = ' <html> <head> <title>Registration at codexplained</title> </head> <body> <p>Hello '.clean($_POST['regUsername']).',</p> <p>Thank you for registering at our website! </p> <p>If you wish, you can now edit your profile, to change your display options and/or to upload your own profile image!<br /> We hope to see you commenting on our articles soon!<br /> If you wish to receive more information - Please contact us, or message any of our moderators.</p> <hr /> <p>- Current moderators - <br /> Ruud<br /> Willem<br /> Quint </p> <hr /> </p> - Contact details - <br /> Codexplained.tk<br /> Codexplained@gmail.com </p> </body> </html> '; $from = "Codexplained@admin.com"; $headers = 'From: Codexplained'."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = clean($_POST['regEmail']); if ( mail($to,$subject,$message,$headers) ) { // Success } else { // Failed } // Insert data $query = "INSERT INTO `users` ( `Id` ,`Username` ,`Password` ,`Rank`,`E-mail` ,`PostAmount`, `ProfileImage`, `Ip`, `LastIP` ) VALUES ( NULL , '".clean(trim($_POST['regUsername']))."' , '".$encryptPass."' , 'member', '".clean($_POST['regEmail'])."' , '0', 'none', '".$_SERVER['REMOTE_ADDR']."','".$_SERVER['REMOTE_ADDR']."' ) "; mysql_query($query)or die(mysql_error()); $error = 'Registration completed!'; } } else { if ( clean($_POST['regPassword']) != clean($_POST['myPassCheck']) ) { $error = 'Passwords do not match...'; } else { $error = 'Registration failed - not enough data..'; } } } echo $error; exit; mysql_close(); //header("location:../index.php?page=register"); ?> And here is the form code: Code: [Select] <?php session_start(); ob_start(); connectToDB(); $query = "SELECT * FROM `users`"; $result = mysql_query($query); $num = mysql_num_rows($result); echo ' <div id="registerHolder"> <h1> <strong> Registration </strong> </h1> <em>Currently... we have '.$num.' registered members! Join them by filling in the form below!</em><br /> <p> Please fill in these boxes and press confirm to register: <br /> <form id="registerForm" method="post" action=""> <table> <tr> <td style="width:200px"> Username: </td> <td> <input name="regUsername" type="text" id="regUsername" style="width:300px" class="box" value="" /> </td> </tr> <tr> <td> Password: </td> <td> <input name="regPassword" type="password" id="regPassword" style="width:300px" class="box" value="" /> </td> </tr> <tr> <td> Confirm Password: </td> <td> <input name="myPassCheck" type="password" style="width:300px" id="myPassCheck" value="" /> </td> </tr> <tr> <td> E-mail: </td> <td> <input name="regEmail" type="text" id="regEmail" style="width:300px" class="box" value="" /> </td> </tr> <tr> <td> <input type="submit" name="Submit" class="btn" value="Confirm" onclick="register()" /> </td> </tr> </table> <br /> </form> </p> <div id="response"> </div> </div> '; ?> I am wondering what I missed, and hoped someone out here could assist me. Thanks in advance. Edit: Added register.php code (form) Hello, I've been trying this for hours now, looking at different examples and trying to change them to work for me, but with no luck... This is what I am trying to do: I have a simple form with: - 1 input field, where I can enter a number - 1 Submit Button When I enter a number into the field and click submit, I want that number to be send to the php file that is in the ajax call, then the script will take that number and run a bunch of queries and then return a new number. I want that new number to be used to call the php script via ajax again, until no number is returned, or something else is returned like the word "done" or something like that, at which point is simply makes an alert or populated a div with a message... The point is, that depending on the number entered it could take up to an hour to complete ALL the queries, so I want the script that is called to only run a fixed amount of queries at a time and then return the number it is currently at (+1), so that it can continue with the next number when it is called again. I would like to use jquery, but could also be any other way, as long as I get this to work. I already have the php script completed that needs to be called by the ajax, it returns a single number when being called. Thank you, vb Hi Guys, I'm trying the following.. returning an array from a php function to Ajax success but the alert seems to only display undefined. PHP Code: [Select] public function reply() { $item_id = $this->uri->segment(3); $type = $this->uri->segment(4); if($type == 1){ $data['get_news_item'] = $this->Newsletter_model->get_news_item($item_id); $test = array( "Paul", "Mike"); return $test; } } AJAX Code: [Select] $.ajax({ type: "POST", url: "<?php echo site_url(); ?>newsletter/reply/"+id+"/"+type, cache: false, success: function (data){ alert(data[0]); // So this should display "Paul"? }); [/code] Hi All, I don't really need help with the code, I just need to know the process... This will take place in a simple form. The user enters the payment information and checks off 'Send Receipt' option. From there, the payment data is stored in the DB. Then, I need to have a PDF generated of the receipt and finally email the tenant with confirmation and the PDF that was created. Once the data is inserted, I can use fPDF to merge the data to the PDF document I created. That part I don't understand is how to automatically save that file and attach it to an email. Ideas / suggestions? Please help me in this guys....... I am using MVC model for my application . I am stuck with the ajax call. this is my controller application/controller/admin/index.php function getCity() { $city=$this->model->getCity(); foreach($this->city as $key => $value) { echo '<option>'.$value['name'].'</option>' ; } } this is my model application/model/admin_model.php public function getCity() { if($_POST['id']) { $cid=$_POST['id']; $sth = $this->db->prepare('SELECT id, name FROM unit WHERE cid= :cid'); $sth->execute(array(':cid' => $cid)); return $sth->fetchAll(); } } this is my view <form id="city" action="<../application/admin/regstr/" method="post"> Country <select name="country" class="country"> <option value="" selected="selected">--Select Taluka--</option> <option value="1">India</option> <option value="2">USA</option> <option value="3">China</option> </select> City <select name="city" class="city"> <option selected="selected">--Select City--</option> </select> <input type="submit" /> </form> and this is my javascript for Ajax $(document).ready(function() { $(".country").change(function() { var id=$(this).val(); var dataString = 'id='+ id; $.ajax ({ type: "POST", url: "admin/getCity", data: dataString, cache: false, success: function(html) { $(".city").html(html); } }); }); }); But I am not getting the output. I have tested it with firebug in response tab. Instead of getting only option values html code as output I am getting the whole HTML page content (i.e. content of view page admin/index.php. Please help me out. Hello guys is it possible to create a single php file to contain all the functions to be called via AJAX and get AJAX to call the specific function required rather than having to create individual pages for each AJAX request you need to make? Many Thanks Hi
I have an AJAX call that populates a select menu based on the selection from a previous menu. All works on on desktop browser, Safari, Firefox IE etc, however when using iOS the second select menu isn't populating.
the AJAX request is as follows
<script> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getTeam(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('away-team').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getGP(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('gp').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script>and the trigger for it... <select name="year" class="txtfield" onChange="getGP('find_gp_ajax.php?season='+this.value)">Any ideas why the call won't work on iOS? This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=334644.0 Hey guys, I'm making an Ajax call to my database and retrieving a newsletters HTML code as the result. I then prepend it into a div area called code_content. I use some php str_replace to add some links also. When the content loads into the div, the user can then add further content to it via Ajax calls, appending articles and that. What I'm trying to figure out is how can I then retrieve all the newly edited contents of this code_content div soni can send it to my Ajax function to write to te db? Can anyone figure out why this works in IE and Firefox but not Safari? Any help would be great. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Concept Builders</title> <link href="_css/main.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="_css/megamenu.css" type="text/css" media="screen" /> <script src="_scripts/pagebuilder.js" type="text/javascript"></script> <script src="_scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="_scripts/jquery.nivo.slider.pack.js" type="text/javascript"></script> <script src="_scripts/jquery.easing.1.3.js" type="text/javascript"></script> <script src="js/megamenu.js" type="text/javascript"></script> <?php include 'dbconfig.php'; include 'dbopen.php'; $plan=$_GET["plan"]; $sql = "SELECT * FROM homes WHERE plan_id= '".$plan."'"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $price=$row['price']; $sqft=$row['sqft']; $beds=$row['bedrooms']; $baths=$row['baths']; $amenities=$row['amenity_1'].", ".$row['amenity_2']; } setlocale(LC_MONETARY, 'en_US'); $price=money_format('%(#6.0n', $price); $plan_details= "<table> <tr> <td width='182' class='propDetailsHeadings'>Price:</td> <td width='75'>".$price."</td> </tr> <tr> <td class='propDetailsHeadings'>SQ Feet:</td> <td>".$sqft."</td> </tr> <tr> <td class='propDetailsHeadings'>Amenities:</td> <td></td> </tr> <tr> <td>".$amenities."</td> <td></td> </tr> </table>";?> <script language="javascript" type="text/javascript"> function loadPage() { var ajaxDisplay = document.getElementById("plan_details"); ajaxDisplay.innerHTML = <?PHP echo $plan_details;?>; } </script> </head> <body onload="loadPage()"> Hi, This is my first post in this forum and am a PHP beginner. I have written a script in php and need to use echo to see the values of variables etc. However I dont get the output on the screen while using echo . I am using Xampp server with Apache. The startup.html file code is
<!DOCTYPE HTML>
</head>
and the test.php code is <?php
$lat = $_REQUEST['latitude'];
echo 'latitude- '.$lat . ', longitude- ' . $lon; Please help regards
Sanjish I have a page that functions like this:
The user begins by loading ajaxtest.php, then using a drop-down menu, selects a user, after which a DIV on ajaxtest.php is populated with the user's selction to getuser.php?q=John%Doe
Here's a visual representation of what is currently happening, along with the part I don't understand.
getuser.php consists largely of a a large HTML table which interacts through PHP with my SQL database. Several of the fields in this table are editable, and after the user changes one of these fields, he can press an "update" button, which calls an AJAX script in update.js and runs update.php, which contains all my SQL queries to update the database, without the user being redirected to this update.php page. All of this is processing perfectly - the user makes some sort of edit, hits "update", and the database gets updated without any redirection or refresh.
Here's what I can't figure out though. Once the user makes a change, and hits "update," the database updates, but the end user doesn't see those changes that he made. I can't just do a simple page refresh, because the action is taking place on getuser.php, but getuser.php is loaded inside of a #DIV on ajaxtest.php. If I use something like window.location.reload(), this just refreshes ajaxtest.php and puts the user back to the starting point of having to select a user. This is not what I want. I don't want to refresh ajaxtest.php, I want to "refresh" ajaxtest.php with getuser.php?q=John%Doe insidethe DIV on ajaxtest.php.
It seems like this is very common - several forums have this capability, where a user has a page loaded, adds a comment, and sees that comment immediately without a full page refresh. I just don't know how to do it, and I've tried at lengths to search the web for an answer with no luck.
Can someone walk me through how to do this?
This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=357605.0 Where is my "Progr" return value?
This is not my first day using php but I don't code in the language that often. I don't understand why my dynamic variable is not returned in AJAX GET? Essentially, I need to give the client a simple UI so that they can copy files to a printer and I wanted to provide a little unfiltered feedback so they knew whether operation was a success. My feedback was just going to be output of exec() function though cleaned up slightly (perhaps replace line breaks with html break tags). PHP version is 5.2.17.17 and cannot be upgraded. Web Server Apache.
PHP dumbed down code:
exec("LoadZPL_PURL.bat", $output); This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=314220.0 Hello All, I have a PHP web application which will refresh itself(ajax calls connecting to the server and get the latest data) periodically. These also update the Database-based session handler class. i.e. There is NO UPDATE to the session data but the timestamp is constantly updated. Our problem is that garbage collection does not kick in as it looks at the difference between timestamp and session_gc.maxlifetime. So, if and the user is not interacting with the application. Now my question is how can I force the timeout even though refreshing happens but the user is not interacting with the application and there are "phantom" session updates made by these ajax calls. Please let me know. Thanks. Hi Everyone,
I am struggling with a pdf.
On our server I get the pdf as a byte array from the database, which I then build up in a StreamingOutput object and return as a pdf file. This is done using java using JAX-RS service.
Now when I open the path/link in my browser(chrome/firefox) the pdf opens in the browser. So this means my backend is working.
On my webapp I want to use $.ajax to download the pdf and view it in an Iframe or embed it in an <embed> or <object> tag. I need to do this as the service call is actually under username and password, and we do not create a session between the browser and the server - there is a long explanation for this.
I saw the option to use http://[username]:[password]@www.myserver.com/... but this was dropped by most browsers. This is why I am trying ajax.
Now in my ajax call I do receive the pdf in the success function as:
%PDF-1.4....This open the browser's pdfviewer correctly and every thing, but the pdf only returns blank pages. The Base64 is a java object that I found on the internet. But I have tried it without the base64 but still now luck. Here is my success function from my ajax call. success: function(data, status, xhr) { var pdfText = Base64.encode(xhr.responseText); var url = "data:application/pdf;base64," + escape(pdfText); var html = '<embed width=100% height=600' + ' type="application/pdf"' + ' src="' + url + '">' + '</embed>'; $("div.inner").html(""); $("div.inner").append(html); }, I need some help adjust a search form that uses PHP/MySQL/AJAX/JQuery. I am not sure what area needs to be adjusted, but I think it's in the Query. The search from searches across the MySQL database of sports team info and works fine. the only problem is in the return of one key word when I needed the exact match of two or more words. For instance you type in 'Miami Heat' and the results returned are for 'Miami Heat' and 'Miami Dolphins', so anything with the key word Miami is returned. Here is the PHP code <?php $dbhost = "localhost"; $dbuser = "username"; $dbpass = "pw"; $dbname = "db_name"; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); if(isset($_GET['query'])) { $query = $_GET['query']; } else { $query = ""; } if(isset($_GET['type'])) { $type = $_GET['type']; } else { $query = "count"; } if($type == "count") { $sql = mysql_query("SELECT count(category_id) FROM players WHERE MATCH(sport,first_name,last_name,MVP,team) AGAINST('$query' IN BOOLEAN MODE)"); $total = mysql_fetch_array($sql); $num = $total[0]; echo $num; } if($type == "results") { $sql = mysql_query("SELECT sport,first_name,last_name,MVP,team FROM players WHERE MATCH(sport,first_name,last_name,MVP,team) AGAINST('$query' IN BOOLEAN MODE)"); echo "<table>"; echo "<tr>"; echo "<th>First Name</th><th>Last Name</th><th>Team</th><th>MVP</th>"; while($array = mysql_fetch_array($sql)) { $sport = $array['sport']; $first_name = $array['first_name']; $last_name = $array['last_name']; $team = $array['team']; $MVP = $array['MVP']; echo "<tr><td>" . $first_name . "</td>\n<td>". $last_name ."</td>\n<td>" .$team."</td>\n<td> . $MVP .</td>\n</tr>\n"; } echo "</table>";=\ } mysql_close($conn); ?> Hi there, I am using the jQuery, Ajax PHP code which is given at http://roshanbh.com.np/2008/04/ajax-login-validation-php-jquery.html The form I am using, which is in index.html, is: Code: [Select] <form method="post" action="" name="login" id="login_form"> <div class="field_row"> <div class="label_container"> <label>Email</label> </div> <div class="field_container"> <input type="text" placeholder="login with your email address..." name="email_address" id="email_address" value="" class="large" /> </div> <div class="clear"><span class="nodisp"> </span></div> </div> <div class="field_row"> <div class="label_container"> <label>Password</label> </div> <div class="field_container"> <input type="password" placeholder="...and password" name="password" id="password" value="" class="large" /> </div> <div class="clear"><span class="nodisp"> </span></div> </div> <div class="final_row"> <input type="image" src="images/login_blue.gif" id="user_login_button" name="user_login_button" value="login" id="submit" class="submit_button" /> <div class="final_row_text_container" > <a href="/login/forgot_password" style="color: #008ee8;" class="small_text">Forgot your Password?</a> <br /> <span id="msgbox" style="display:none"></span> </div> </div> <div class="clear"><span class="nodisp"> </span></div> </form> The Javascript, which is situated in the head of index.html. is: Code: [Select] <script language="javascript"> $(document).ready(function() { $("#login_form").submit(function() { //remove all the class add the messagebox classes and start fading $("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000); //check the email address exists or not from ajax $.post("login_ajax.php",{ email_address:$('#email_address').val(),password:$('#password').val(),rand:Math.random() } ,function(data) { if(data=='yes') //if correct login detail { $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1, function() { //redirect to secure page document.location='secure.php'; }); }); } else { $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Your login details are incorrect.').addClass('messageboxerror').fadeTo(900,1); }); } }); return false; //not to post the form physically }); //now call the ajax also focus move from $("#password").blur(function() { $("#login_form").trigger('submit'); }); }); </script> And the PHP, in login_ajax.php, is: <?php session_start(); $host = "localhost"; $user = "bford"; $pass = "bford"; $db = "bford"; $link = mysql_connect($host, $user, $pass); if (!link) { die('<strong>Error(s) occured:</strong> Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($db, $link); if (!db_selected) { die ('<strong>Error(s) occured:</strong> Cant use bford: ' . mysql_error()); } //get the posted values $email_address=$_GET['emailaddress']; $pass=$_GET['password']; //now validating the username and password $sql="SELECT * FROM users WHERE email_address='".$email_address."'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); //if username exists if(mysql_num_rows($result)>0) { //compare the password if($row["password"],$pass)==1 { echo "yes"; //now set the session from here if needed $_SESSION["user_name"]=$userID; } else echo "no"; } else echo "no"; //Invalid Login ?> I have been working on this for days now, changing around the form names, database table names, php variables, allsorts! I still cannot get it functioning properly. When I input a correct email_address and password combination, the 'Your login details are incorrect.' message still appears. Help would be much appreciated. Ben. Hello, everyone. I have code that effectively calls a PHP page with AJAX (no JQuery). The PHP responds fine with an echo. Here is the javaScript that calls the PHP so refreshing the page doesn't need to be done.
function deleteCategory() { var e= document.getElementById("dropDown1"); var var1 = e.options[e.selectedIndex].text; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = alerta() { if (this.readyState == 4 && this.status == 200) { document.getElementById("insert").innerHTML = xmlhttp.responseText; } }; xmlhttp.open("GET", "deleteRow.php?q=" + var1 , true); xmlhttp.send(); } How do I call a PHP function on the same page while preserving the above AJAX.
Sincerely, Joshua |