を提出していないだろう、私はどこかの例から作業を開始し、この構築された:HTML5フォームが
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.5.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
<script>
jQuery(window).ready(initiate_geolocation);
function initiate_geolocation() {
navigator.geolocation.getCurrentPosition(handle_geolocation_query,handle_errors);
}
function handle_errors(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED: alert("user did not share geolocation data");
break;
case error.POSITION_UNAVAILABLE: alert("could not detect current position");
break;
case error.TIMEOUT: alert("retrieving position timed out");
break;
default: alert("unknown error");
break;
}
}
function handle_geolocation_query(position){
document.geo.lat.value=position.coords.latitude;
document.geo.lon.value=position.coords.longitude;
}
</script>
<title>GPS data collection</title>
</head>
<body>
<form action="processgeo.php" method="post" enctype="multipart/form-data" name="geo" id="geo">
<fieldset>
<label for="lat">Lat</label>
<input type="text" id="lat" name="lat" />
<br />
<label for="lon">Lon</label>
<input type="text" id="lon" name="lon" />
<br />
<label for="title">Title</label>
<input type="text" id="title" name="title" />
<br />
<label for="type">Type</label>
<select name="type" id="type">
<option value="entrance">entrance</option>
<option value="intersection">intersection</option>
<option value="parking">parking</option>
</select>
<br />
<input id="submit" type="submit" value="Send data" />
</fieldset>
</form>
</body>
</html>
を私は変更のすべての種類を試してみましたが、フォームが提出しなくなります。送信ボタンをタップすると、ただ点滅しますが、アクションファイルをロードしようとしません。
私が見つけた1つのことは、すべてのスクリプトタグを削除すると、フォームは正常に送信されます。ページにjQueryコーディングを組み込むと、それが送信できなくなるのはなぜですか?私は入力の検証をしようとしていません。
"processgeo.php"というアクションファイルが存在することを確認しましたが、自分自身に送信するようにアクションを設定しようとしました。同じ結果。
UPDATE 2012-01-17:
私はこのいじり維持し、それが仕事を始めました。私はそれを機能させるために何が変わったのか今は思い出さない。上記掲載のコードに比べると、私はこれらの変更を参照してください。
は、ヘッド部に
<link href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css">
を追加しました。私はそれがうまく作られた特定のアイテムを見つけた場合
が再び編集します= "アプリケーション/ x-www-form-urlencodedで" ENCTYPEする
変更フォーム。
フォームでdata-ajax = "false"を試しましたか?デフォルトでは、JQMはフォームの投稿をAJAX呼び出しとして送信します。 詳細については、http://jquerymobile.com/test/docs/forms/forms-sample.htmlをご覧ください。 – Trevor
いいえ、私はそれを試していませんでした。それは知って良いです、ありがとう。私が何かを試していたとき、それは働き始めました。それを見ると、私は有意に異なるものは見ません。私はオリジナルの投稿を現在のコードで更新しようとします。 –