douji1999
2014-04-23 23:00
浏览 53

似乎无法使用javascript将输入文本字段值的值转换为隐藏的表单字段

So I have a fiddle of the code: http://codepen.io/databaseindays/pen/JGdgq

The idea is that the user can find their coordinates and then submit them via POST variables in hidden fields in the form.

Im using JQuery to simply read the lat and lang fields value into the hidden fields. But the POST variables are always empty. The values are not being copied.

One theory is that I have the hidden fields inside a FORM, while the inputs im trying to copy are not. So first question is, is that a scope issue? If so, should I omit the Form and submit another way, if that will give me access to the values?

Thanks

Norman

图片转代码服务由CSDN问答提供 功能建议

所以我有一个小提琴代码: http://codepen.io/databaseindays/pen/JGdgq

想法是用户可以找到他们的坐标 然后通过POST变量在表单中的隐藏字段中提交它们。

我使用JQuery简单地将lat和lang字段值读入隐藏字段。 但是POST变量总是空的。 这些值没有被复制。

一种理论是我在FORM中有隐藏字段,而我尝试复制的输入则没有。 所以第一个问题是,是范围问题吗? 如果是这样,我是否应该省略表格并提交另一种方式,如果这样可以让我访问这些值?

谢谢

Norman

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsymx68408 2014-04-23 23:17
    已采纳

    OK, you're probably going to kick yourself when you see this. I know it took me a few minutes before I noticed.

    It looks as if you're trying to copy the value in the jQuery block at the bottom of the page. However, that bit of code is only running when the document is ready, and NOT when the geocoding operation takes place.

    打赏 评论

相关推荐 更多相似问题