更新:我想传递var value给服务器
你好,同样老,同样老...... :)
我有一个名为的表单<form id="testForm" action="javascript:test()">和一个名为的代码区域<code id="testArea"></code>
我正在使用此代码在代码区域中字符串化并显示数据:
var formData = form2object('testForm');
document.getElementById('testArea').innerHTML = JSON.stringify(formData, null, '\t');
var value = JSON.stringify(formData, null, '\t');
Run Code Online (Sandbox Code Playgroud)
我想要的是将此数据发送到JSON文件.我一直在研究这个项目:http://ridegrab.com/profile_old/如果按下Submit Query按钮,你会看到页面的头部填充.
另外我想用这段脚本发送数据:
function authenticate(userName, password) {
$.ajax
({
type: "POST",
//the url where you want to sent the userName and password to
url: 'username:password@link to the server/update',
dataType: 'json',
async: false,
//json object to sent to the authentication url
data: '{"userName": "' + userName …Run Code Online (Sandbox Code Playgroud)