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
https://forums.phpfreaks.com/topic/132577-issue-in-ie/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.