Strawberry
Strawberry

Reputation: 67868

Ajax doesn't work in iPhone safari

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>

Upvotes: 0

Views: 1375

Answers (1)

Strawberry
Strawberry

Reputation: 67868

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.

Upvotes: 1

Related Questions