So I have this simple ajax script to add entries to the DB, and it returns the result.
The serverside stuff works fine, and actually the AJAX part of it works in my desktop version of Safari! However when I open it on the iPhone, it doesn't do anything.
Can someone explain to me what the limitations of the iPhone are that prevents this from working and how I can fix it!
Thank You,
The serverside stuff works fine, and actually the AJAX part of it works in my desktop version of Safari! However when I open it on the iPhone, it doesn't do anything.
Can someone explain to me what the limitations of the iPhone are that prevents this from working and how I can fix it!
Thank You,
Code:
<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var name = document.getElementById("name").value;
var ip = document.getElementById("ip").value;
var shout = document.getElementById("shout").value;
var queryString = "?name=" + name + "&ip=" + ip + "&shout=" + shout;
ajaxRequest.open("GET", "shouts_ajax_post.php" + queryString, true);
ajaxRequest.send(null);
}
//-->
</script>
<form name='myForm'>
<input type='text' id='name' value="Name" /> <br />
<input type='hidden' id='ip' value="<?= $_SERVER['REMOTE_ADDR'] ?>" />
<br />
<textarea id="shout" >Tap here to shout</textarea>
<input type='button' onclick='ajaxFunction()' value='Shout!' />
</form>
<div id='ajaxDiv'>Your result will display here</div>