tags:

views:

85

answers:

1

How would you code the function replaceFormParamsWithJsonObject(jsonObject)?

$('#myForm').submit(replaceFormParamsWithJsonObject(jsonObject));
A: 

Not sure exactly what you're after but something like this?

$.each(jsonObject, function(key, value)
{
    $(this).find('input:[name=' + key + ']').val(value);
});

This will update the form inputs with names corresponding to the object's keys.

Greg