View Full Version : Simple JSON Question

02-27-2009, 04:03 PM
Got a simple JSON question - here's the code that I'm using to setup a JSON dataset:

var inputs = $('#addnewbuyer').contents().find('input');
var postArray = new Array();
var postJson = {};
$.each(inputs, function(i,input){
var inputId = $(input).attr('id');
var inputVal = $(input).val();
postJson = { inputId : inputVal };

I'm using jQuery to assist with this.

Here's the problem. In the line where I set postJson I want the inputId to change based on the ID of the element I am using.

Is there an easier way to do this (or a way in which it will actually work)?