jQuery改变了页面 - 但是我怎样/在哪里“获取”变化? [英] jQuery alters page - but how/where do I "acquire" the changes?
问题描述
这篇文章由@BenjaminRH(如何使用jQuery更改/编辑段落/ div的文本?)提供了我正在尝试构建的功能。
通过点击一个按钮,在页面上创建一个新的段落,可以编辑并保存到页面中。
我想将它保存到数据库中。当我在编辑后查看页面源时,我没有看到那里的更改,这并没有让我感到意外......但我不知道在哪里捕获已更改的文本,以便我可以验证并发布到MySQL的。
好的,我已经为自己设法解决了这个问题,而不使用ajax。我从(如何使用jQuery更改/编辑段落/ div的文本?)的例子,并通过将元素放在(html)表单中进行修改。
第二个修改是使用 正如@caspian指出的那样(在评论中),这两个步骤填充 This post by @BenjaminRH (How to change/edit the text of a paragraph/div using jQuery?) provides exactly the sort of functionality I'm trying to build on. By clicking on a button, a new paragraph is created on the page, which can be edited and saved to the page. I want to save it to a database. When I look at the page source after editing, I don't see the changes there, which doesn't surprise me... but I don't know where to "capture" the changed text so that I can validate and post to mySQL. OK, I've managed to solve it for myself, without using ajax. I took the example from (How to change/edit the text of a paragraph/div using jQuery?) and modified it by placing the elements in an (html) form. The second modification was to use As @caspian pointed out (in the comments) those two steps do populate the 这篇关于jQuery改变了页面 - 但是我怎样/在哪里“获取”变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!< textarea>
元素,而不是< p> ; 元素无法发布,因为
< p>
元素。
$ _ POST
数组,然后我们走。 <textarea>
elements, not <p>
elements, as <p>
elements cannot be posted. $_POST
array and away we go.