Send information with ajax and go to another page

Viewed 23

I have one.php where I load two.php with jQuery/Ajax. I want to do something in two.php and then make one.php go to three.php

(With the code I have here, the loaded page goes to three but not the whole HTML page one.php)

one.php: (HTML document)

$(function(){
     $("#send").click(function(){
        var name = $("#name").text();    
        $("#loaded").load("two.php",
        { name: name },
        function(){
            //I cannot send to three.php here as I need some information that is processed in two.php
        }); 
     });
}

<div id="name" contenteditable="true">Name</div>
<div id="send">Send</div>
<br>
<div id="loaded"></div>

two.php: (only PHP)

if( isset($_POST["name"]) ){    
    // do something an then send one.php to three.php
    header('Location: three.php');
}
0 Answers
Related