使用javascript更改包含方向

I'm trying to change an include path with JavaScript. It need's to go from this

<?php include 'sections/welcome.php'; ?>

to this

<?php include 'sections/new_visitor.php'; ?>

to this

<?php include 'sections/nda.php'; ?>

and so on... do anybody know how to code this in JavaScript?

you can't change how PHP is coded via javascript. You can send variables to php via javascript and then PHP responds to those variables... it looks like you have a registration of sorts. If you're using standard HTTP requests, you could use javascript to append a $_GET variable to the action link. For Instance:

 $('#form').attr('action', $('#form').attr('action') + '?page=welcome'); 

Then, upon clicking the link, PHP will have access to $_GET['page'], so in php you could:

 switch($_GET['page'])) {
     case 'welcome':
         include 'section/welcome.html';
         break;
     case 'nda':
         include 'section/nda.html';
         break;
 }

Look at the if(message ===1) statement below:) sorry for being such a noob :P

var xmlHttp = createXmlHttpRequestObject();

            function createXmlHttpRequestObject(){
                var xmlHttp;

                if(window.ActiveXObject){
                    try{
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
                    }catch(e){
                        xmlHttp = false;
                    }
                }else{
                    try{
                       xmlHttp = new XMLHttpRequest();
                    }catch(e){
                        xmlHttp = false;
                    } 
                }

                if(!xmlHttp){
                    alert("cat create that object hos");
                }



       function newuser(){
           if(xmlHttp.readyState ===0 || xmlHttp.readyState ===4){
             name = encodeURIComponent(document.getElementById('name').value);
             company = encodeURIComponent(document.getElementById('company').value);
             nationalities = encodeURIComponent(document.getElementById('nationality').value);
             phonenumber = encodeURIComponent(document.getElementById('phonenumber').value);
             queryString = "?name=" + name + "&?company=" + company + "&?nationalities=" + nationalities + "&?phonenumber=" + phonenumber + "&?URL= newuser";
             xmlHttp.open("GET", "/php/database.php?" + queryString, true);
             xmlHttp.onreadystatechange = handleServerResponse;
             xmlHttp.send(null);
           }else{
               setTimeout('newuser()', 1000);
           }
       }

       function handleServwerResponse(){
           if(xmlHttp.readyState ===4){
               if(xmlHttp.status === 200){
                   xmlResponse = xmlHttp.responseXML;
                   xmlDocumentElement = xmlResponse.documentElement;
                   message = xmlDocumentElement.firstChild.data;

                   if(message === 1){

//I want to call a function here, so i can change the include path

               }else{
                   document.getElementBy("underInput").innerHTML = 'User already exist klick to sign in here <p style="color:blue" onclick=""></p>';
               }
           }

       }
   }




}