Jump to content

Ajax or some other issue - Garbage Collection ????


Nacman

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.