79405821

Date: 2025-02-01 23:12:31
Score: 1
Natty:
Report link

When programming with jQuery, simply put the variable within brackets to send the string value of the variable as the key name.

var SomeElement = 'data1';

$.ajax({
    type: 'post',
    url: 'form/processor/page',
    data: { [SomeElement] : 'val1' },
    ...
});
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: Stan S.