Nacman Posted January 18, 2011 Share Posted January 18, 2011 Hey all, Second post....I am a noob, and I am stumped. I have searched and applied what I think is the issue, but it doesn't fix it. I am inluding a link to a test page so you can experience the bug first hand. I have the page visitor enter in some airport codes for a flight search. Ajax goes to work. I am using onkeyup to fire the script. Once the user type the last of 4 letters, all airport codes are 4 letters usually....for what ever reason, the page forgets what was type and it refills it with random unsequenced records. Backspacing the last letter and then retyping it causes it to lock finally with no more random records. If the user then goes to the arriving airport and adds more search criteria, it also looses it's mind untill the last letter is retyped. I have tried both GET and POST methods, I don't think that is the issue, but I tried it, no difference. I tried placing a timer on onkeyup events, no difference. Obviously, as the user type more info in more boxes, my mysql queries change to accommodate....is this the cause??? Here is the link...try it for yourself. http://easternairlinesvirtual.org/site/Portals/0/php/pirep/fltsch1.html For example, type in KATL in the Departing box....wait till finished and watch it flip to something else... function ajaxFunction(){ var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Not Working"); return false; } } } // Create a function that will receive data sent from the server var dicao = document.getElementById('dicao').value; var aricao = document.getElementById('aicao').value; var acicao = document.getElementById('acicao').value; var schtype = document.getElementById('schtype').value; var fltnum = document.getElementById('fltnum').value; var queryString = "dicao=" + dicao + "&aicao=" + aricao + "&acicao=" + acicao + "&schtype=" + schtype + "&fltnum=" + fltnum + "&sid=" + new Date().getTime(); var url = "livesearch1.php"; ajaxRequest.open("POST", url, true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxRequest.setRequestHeader("Content-length", queryString.length); ajaxRequest.setRequestHeader("Connection", "close"); ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){ var ajaxDisplay = document.getElementById('livesearch'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } ajaxRequest.send(queryString); } //--> </script> Quote Link to comment https://forums.phpfreaks.com/topic/224802-ajax-or-some-other-issue-garbage-collection/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.