JSFiddle - React, Tailwind, and code Playground
HTML
<!--
Is this a bug or feature?
jQuery does not add a key component for undefined values
(Tested with 1.4.4, 1.5.2)
-->
JavaScript
$(function() {
var MyObj = {};
var params= {"MyKey": "MyValue", "OtherKey": MyObj.UndefinedKey, "ThirdKey": ""};
var foo = $.param(params, false);
$.ajax({
type: 'GET',
url: 'http://example.com/SomePage',
data: params,
complete: function(xhr, textStatus) {
$("body").html("Params: " + foo + "<br/>URL: " + this.url);
}
});
});