tags:

views:

418

answers:

1

My ajax works fine in firefox but it does not work on my iPhone. I thought it might have been the XMLHttpRequest but that doesn't seem to be the issue. I am for sure it's not my php script. Sorry that I didn't post it earlier. It was really hard to post on iPhone, especially since I can't scroll down to highlight all the code

Here is my submit:

<form action="#" onsubmit="function()">
<input type="text" value="" />
<input type="submit" value="Submit" />
</form>
+1  A: 

I discovered the answer. It turns out, the code is fine - 100% fine, except the HTML form. So I noticed my Safari was refreshing everytime I hit submit.

<form onsubmit="return false;" >
<input type="text" value="Blah" />
<input type="submit" value="Submit" onclick="function()" />
</form>

Okay, so the onsubmit="return false;" will keep the page from refreshing.

Doug
Aww, this doesn't work for IE.
Doug
I found out IE doesn't work when you hit "enter", but add this and it will. <input type='text' style='visibility: hidden; display:none;' name='Stupid-IE'> I hate IE
Doug
GOD I HATE IE! I found another bug in my script. It works in every other browser (FF and SAFARAI) except for IE.
Doug
Okay, I have two conditions, if the submit data is not in the databse, then add data and echo "success". I also have, if submit data is in database then don't add it and echo "already in db". So, when i add a new code, it echo "success" and it's added into the databse, and if I try submitting it again, it just saids "success" again. I would have to restart IE7 inorder for it to act properly and receive the latter message of "already in db". Any ideas?
Doug
The caching problem is IE's problem, I had to make my URL unique. My original question was answered.
Doug