javascript - jQuery .post or .get pass dynamic parameters -


the common way send request server is

$.get('link/to/send', {    param1: "value1",    param2: "value2" }, function(result) {    // ... etc }); 

now if want send dynamic parameter names, can jquery support that? (i.e. need write generic code can specify parameter names @ runtime)

this not jquery dependent, it's vanilla javascript.

you should this:

var objtosend = {}; objtosend["param1"] = "value1"; objtosend["param2"] = "value2";  $.get('link/to/send', objtosend, function(result) {     // ... etc }); 

Comments

Popular posts from this blog

c - Calling a function within a loop -

vb.net - Unbound DataGridView add row with checkbox error -

How i fill combobox items in Radgridview manually using in vb.net -