javascript - Ajax function: data fields with multiple value -
i have doubt data fields of ajax function.
usually, have syntax ajax function may be:
$.ajax({ url: "/aaa/bbb/ccc", method: "somemethod", data: somedata, success: function (response) { } my question is: in data fields, can put more 1 data? in other words, can pass from:
data: somedata, to:
data: data1, data2, data3... and on?
here how can build multiple params, hold them in object , send them json.stringify():
var paramstosend = {}; paramstosend['data1'] = 'data1'; paramstosend['data2'] = 'data2'; $.ajax({ ... data: {params:json.stringify(paramstosend)}, ... });
Comments
Post a Comment