I have a html code which sends the input to the PHP where the php redirect to a login page.
But when i do the post request as bellow, it gives a response back to the javascript; with the forwarding index.html code without redirect to the index.html.
<script>
function Sendmeaway() {
var item_i = document.getElementById("item_select").value;
if (item_i == "Initial_Value") {
alert("Please Select the Correct Option or Enter the Comment");
} else {
$.post("./back_p/add_change_req.php", {
item : item_i
},
function(data, textStatus) {
alert("Response from server: " + data);
document.getElementById("item_select").selectedIndex = 0;
location.reload();
});
}
};
</script>
PHP code (it works fine when i go directly to the php)
<?php echo $_POST["item"]; header('location: ../index.html'); ?>