To begin have a look at the following fiddle: https://jsfiddle.net/ob43hwdu/1/
首先来看看以下小提琴:https://jsfiddle.net/ob43hwdu/1/
with help from this community, JSON data are displayed on screen upon the user hitting the generate button. In the sense that they are various input field that user fills in and when they hit generate, it populates the json data on screen.
在此社区的帮助下,当用户点击生成按钮时,JSON数据将显示在屏幕上。从某种意义上说,它们是用户填写的各种输入字段,当它们命中生成时,它会在屏幕上填充json数据。
What I would want to do is have another input and button known as name and confirm, and once the user clicks on it, it produces a json file with those information that is stored at lets say http://..json/NAMEPROVIDED.json
我想要做的是有另一个输入和按钮,称为名称和确认,一旦用户点击它,它会生成一个json文件,其中包含存储在http://..json/NAMEPROVIDED的信息。 JSON
In other words, as far as button goes, I could have:
换句话说,就按钮而言,我可以:
<fieldset id="buildyourform">
<legend>test</legend>
</fieldset>
<input type="button" value="Add a field" class="add" id="add" />
<input type="button" value="Generate" class="add" id="preview" />
<pre id="json"></pre>
<input type="text" value="name of file">
<input type="button" value="submit">
Thanks in advance
提前致谢
2 个解决方案
#1
2
You wont be able to this with just javascript, jquery, html, json or html5. You'll need some serverside processing to get the string and save it on the system. PHP is simple to use but you have to check what's instaled on your server and if you have permission to create/save files.
你只能使用javascript,jquery,html,json或html5。您需要一些服务器端处理来获取字符串并将其保存在系统上。 PHP易于使用,但您必须检查服务器上的内容以及是否有权创建/保存文件。
#2
#1
2
You wont be able to this with just javascript, jquery, html, json or html5. You'll need some serverside processing to get the string and save it on the system. PHP is simple to use but you have to check what's instaled on your server and if you have permission to create/save files.
你只能使用javascript,jquery,html,json或html5。您需要一些服务器端处理来获取字符串并将其保存在系统上。 PHP易于使用,但您必须检查服务器上的内容以及是否有权创建/保存文件。