在没有html表单的javascript中创建“表单” [英] Creating 'form' in javascript without html form
问题描述
我正在尝试通过javascript动态提交表单(使用jquery-form)
I am trying to submit a form thru javascript on the fly (using jquery-form)
是否有可能创建'FORM'更新一堆值'FORM'使用javascript而没有HTML格式?
Is it possible to create 'FORM' update bunch of values in that 'FORM' using javascript without having HTML-form ?
推荐答案
我猜你要问的是'我可以在不使用HTML表单的情况下执行HTTP POST吗?答案是肯定的。
I'm going to guess that what you're asking is 'Can I perform an HTTP POST without using an HTML form?' The answer is yes.
查看jquery的$ .post()。它看起来像这样:
Check out jquery's $.post(). It would look something like this:
$.post(url, { value1: "foo", value2: "bar" } );
您传递的变量名称是value1 / value2及其对应值。
Where the variable names you're passing are value1/value2 with their corresponding values.
以下是jquery参考: $ .ajax
Here's the jquery reference: $.ajax
这篇关于在没有html表单的javascript中创建“表单”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!