Let's say we have the following piece of code: $.post("/scripts/admin.course.php", { elemname: value1, elemname2: value2 } , function(data){} );
Is there a way to dynamically set the field name? e.g. var elemname = 'newname'; $.post("/scripts/admin.course.php", { elemname: value1, elemname2: value2 } , function(data){} ); Then the data that get's posted would be: array( 'newname' => 'value1', 'elemname2' => 'value2', ) TIA