Jump to content

Issue in IE


glenelkins

Recommended Posts

Hi

 

Below is my ajax code. Iv attached "get_base_unit_sizes" to <select onChange="get_base_unit_sizes ( this.options[this.selectedIndex].value )"></select>

 

Works fine in FF. But it only seems to send back the data from the php script to IE the first time an item in the select list is clicked. In FF if say the number 1 is selected, then number 5 from the list, the function runs over each time i click an item. But IE, oh no! as usual has to be different

 

any ideas?

 

<script type="text/javascript">

// Vars
var ajaxObj = '';

// Create request object
try {

	// Firefox etc
	ajaxObj = new XMLHttpRequest();

} catch ( e ) {

	// Ie
	try {

		ajaxObj = new ActiveXObject("Msxml2.XMLHTTP");

	} catch ( e ) {

		try {

			ajaxObj = new ActiveXObject("Microsoft.XMLHTTP");

		} catch ( e ) {

			alert ( "Your Browser Does Not Support AJAX! You Cannot Continue");

		}

	}

}

function get_base_unit_sizes( quantity, unit_id ) {


	if ( ajaxObj ) {

		ajaxObj.onreadystatechange = function() {

			if ( ajaxObj.readyState == '4' ) {

				var unit_sizes = ajaxObj.responseText;

				var unit_container = document.getElementById ( 'units_' + unit_id );

				unit_container.innerHTML = '';

				for ( var i = 1; i <= quantity; i++ ) {

					unit_container.innerHTML += '<strong>Select Unit ' + i + ' Size: <select name="">' + unit_sizes + '</select><br />';

				}

			}

		}
	}
	ajaxObj.open ( 'GET', 'lib/libraries/base_units.php?a=get_unit_sizes&unit_id=' + unit_id + '&quantity=' + quantity, true );
	ajaxObj.send ( null );

}

</script>
</code]

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.