Reindexing from HTML

Tried that, does not work as well. I've also tried this:

var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "source");
hiddenField.setAttribute("value", "{"source":{"index":"log-*","query":{"term":{"requestId":"reallyniceanduniqueid123"}}}}");

var hiddenField2 = document.createElement("input");
hiddenField2.setAttribute("type", "hidden");
hiddenField2.setAttribute("name", "dest");
hiddenField2.setAttribute("value", "{"dest":{"index":"log-permanentIndex","version_type:external"}}");

and combinations with or without the "{" and using "JSON.stringify" and "form.setAttribute("enctype", "application/json")", no success so far.