http://ubilabs.github.com/geocomplete/を使用して、フォームに緯度と経度を送信させています。以下のトリガーを実行するだけで機能し、緯度と経度のフィールドがいっぱいになります。ただし、submit jquery コードを追加すると、空白のフィールドが送信されます。フィールドがいっぱいになっているのに POST 経由で送信されていないことがわかるので、タイミングのことはわかっています。しかし、私はそれを理解できません、何か提案はありますか?
<script>
$(document).ready(function(){
// Area for any jQuery
$("#geocomplete").geocomplete({
details: "form",
types: ["geocode", "establishment"]
});
$("#geoform").submit(function() {
$("#geocomplete").trigger("geocode");
alert('Handler for .submit() called.');
return true;
});
});
</script>
<form id="geoform" method=post action="/foo.php">
<input id="geocomplete" type="text" placeholder="Type in an address" value="Empire State Bldg" />
<!--<input id="find" type="button" value="find" />-->
<input type="submit" value="Go" />
<fieldset>
<input name="lat" type="text" value="">
<input name="lng" type="text" value="">
<input name="query" type="hidden" value="true">
</fieldset>
</form>