mercredi 25 février 2015

Push json data to server using node.js

I have created a json array from html form shown below using javascript





< script >
function myFun() {
var ServerUser = [];
var inputs = $('input.email'),
tmp;
$.each(inputs, function(i, obj) {
tmp = {
'title': $(obj).attr('title'),
'name': $(obj).val(),
'age': $(obj).siblings('.age').val()
};

ServerUser.push(tmp);
console.log(ServerUser);

});
} < /script>



<html>

<head>
<script src="http://ift.tt/1xDNnh9"></script>
</head>

<form method="post" action="/">
<div>
Name:
<input title="QA" type="text" class="email">Age:
<input type="number" class="age">
</div>
</form>
<input type="submit" value="Submit" onClick="myFun()">


</html>



I want push that json array or json data to server using node.js. Any help would be much appreciated


Aucun commentaire:

Enregistrer un commentaire