bravo14 Posted May 17, 2014 Share Posted May 17, 2014 Hi I have an AJAX call that populates a select menu based on the selection from a previous menu. All works on on desktop browser, Safari, Firefox IE etc, however when using iOS the second select menu isn't populating. the AJAX request is as follows <script> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getTeam(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('away-team').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getGP(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('gp').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> and the trigger for it... <select name="year" class="txtfield" onChange="getGP('find_gp_ajax.php?season='+this.value)"> Any ideas why the call won't work on iOS? Link to comment https://forums.phpfreaks.com/topic/288568-ajax-call-not-working-in-ios/ Share on other sites More sharing options...
Frank P Posted June 1, 2014 Share Posted June 1, 2014 Your code seems OK. The only thing I can think of is that iOS has problems with the try & catch primer function. And why would you wanna use that anyway? IE8+ and all other browsers support XMLHttpRequest(), and coding for IE<8 is a waste of time, if you ask me. IE7 users can easily upgrade to 8, and IE6 has left the building. Link to comment https://forums.phpfreaks.com/topic/288568-ajax-call-not-working-in-ios/#findComment-1481543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.