I am very confused and I cannot find the right way. I have a problem which I'll try to make it simple with the following example. First, code of test.php:
<html>
<head>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script src="test1.js"></script>
</head>
<body>
<input value="press" type="button" onclick="test()">
<script>
alert ("Home");
</script>
</body>
</html>
and now the test1.js code:
function test()
{
alert("Test1");
$.post("test.php");
}
From my point of view I'd expect three alert windows:Test1,Home and Test1 again for I thought test.php would refresh after $.post("test.php") is called. What am I missing? What is my fault?
I want to do exactly that in pages with more complex code (namely, to make a php page to refresh after a click button inside its own body which will execute some JS code first). I 'd appreciate your explanation and your solution as to clarify it.