glenelkins Posted November 13, 2008 Share Posted November 13, 2008 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] Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 15, 2008 Share Posted November 15, 2008 Show us the code with the triggering function. [part of the form with event="get_base_unit_sizes( quantity, unit_id )", where event is something like onclick/onchange/etc] Quote Link to comment 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.