![](/img/trans.png)
[英]Using JavaScript to retrieve more than one value from HTML element?
[英]Retrieve HTML Element Value Using Clojure
我是Web开发的新手,并且正在使用Clojure作为后端语言。
我正在尝试将用户身份验证从前端移动到后端,并且试图从HTML密码字段中检索值。
所以我想知道,是否有Clojure等效于document.getElementById('foo').value
?
我认为您误会了一些东西:服务器无权访问DOM。
您必须发出某种请求(例如AJAX)才能将数据发送到服务器。 它是这样的:
Browser -> request with credentials -> Server (Clojure)
(does it's thing, maybe talk to a DB)
Browser <- response validating the data or not <- Server
您将必须阅读有关该主题的更多信息。
注意:虽然可以在ClojureScript中完全替代JavaScript,但完全可以做到:
(defn by-id [id]
(.getElementById js/document (name id)))
(by-id "foo")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.