SO - 26228304
by Arun P Johny
HTML
<input value="1" input />
<input value="2" input />
<input value="3" input />
<input type="button" id="test" value="test" />
JavaScript
$('#test').click(function () {
process($("[input]"));
})
function process($inputs) {
if (!$inputs.length) {
return;
}
var $input = $inputs.eq(0);
var data = $input.val();
console.log($input.get(), data)
//jsfiddle request ajax format, you need to retain your url and data
$.post('/echo/json/', {
json: JSON.stringify({
data: data
})
}, function (result) {
console.log(result);
}).always(function () {
process($inputs.slice(1))
});
}