I am trying to send post data from from with empty action and send the info with javascript to the file that must handle the post information.
Here is my code:
function post_to_url(path, params, method) {
method = method || "post";
var form = document.createElement("form");
_submit_function_ = form.submit;
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
document.body.appendChild(form);
form._submit_function_();
}
post_to_url("./postinfo.php", { submit: "submit" } );
change to
post_to_url("/postinfo.php", { submit: "submit" } );