Hi, Got something similar to this:
$$("#settings fieldset")[0].insert(new Element("input", { type: "button", name: "updateSettings", id: "updateSettings", value: "Update Settings" }).observe('click', function() { var params = ""; var counter = 0; for (var i = 0; i < inputs.length; i++) if (inputs[i].type != "hidden") { params += "settings[" + counter + "]" + "=" + inputs[i].id + ":" + inputs[i].value + "&"; counter++; } else params += inputs[i].id + "=" + inputs[i].value + "&"; new Ajax.Request('/Composing-SettingsSave.rails', { method: 'post', asynchronous: true, parameters: params, onSuccess: tellSuccessSave, onFailure: tellFailureSave }); }, false).wrap("p")); And as you can see the content is sent using string concatenation. I.e. it's rather ugly and also breaks when I have & characters in the inputs. So instead I want to do something like this: $$("#settings fieldset")[0].insert(new Element("input", { type: "button", name: "updateSettings", id: "updateSettings", value: "Update Settings" }).observe('click', function() { var params = {}; var counter = 0; for (var i = 0; i < inputs.length; i++) if (inputs[i].type != "hidden") { params.push({"settings[" + counter + "]" : inputs[i].id + ":" + inputs[i].value }); counter++; } else params.push({inputs[i].id : inputs[i].value }); new Ajax.Request('/Composing-SettingsSave.rails', { method: 'post', asynchronous: true, parameters: params, onSuccess: tellSuccessSave, onFailure: tellFailureSave }); }, false).wrap("p")); Unfortunately that doesn't seem to work.. Could anyone help me here? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---