I have the following JSON object:
new Ajax.Request(url, {
method: 'post',
contentType: "application/x-www-form-urlencoded",
parameters: {
"javax.faces.ViewState": encodedViewState,
"client-id": options._clientId,
"component-value": options._componentValue
}
});
Now, I would like to be able to append to the "Parameters" object programattically, but I am unsure of how I would actually do this.
you can simply assign to it. But you might want to do that before creating the request.
var parameters = {
"javax.faces.ViewState": encodedViewState,
"client-id": options._clientId,
"component-value": options._componentValue
}
parameters.foo = 'bar';
var myAjax = new Ajax.Request(url, {
method: 'post',
contentType: "application/x-www-form-urlencoded",
parameters: parameters
});
Assume that the JSON object is named as obj in the Ajax.Request Javascript function. You could now add to the parameters object like this:
obj['parameters']['someproperty'] = 'somevalue';
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With