Ajax调用根本不起作用[重复]

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming" dir="ltr">What is the difference between client-side and server-side programming?</a>
                            <span class="question-originals-answer-count">
                                (4 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2015-02-04 22:50:51Z" class="relativetime">5 years ago</span>.</div>
        </div>
    </aside>

i have a very simple ajax call, just so i can test first:

<script  src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function validateLogIn()
{
  var username  = $("#username").val();     
  console.log(username,password,login,remember);
  //alert('Given data is not correct' + username + "   " + password);
  $.ajax({     
    url: 'validate.html'                         
    type: 'POST', // POST/GET
    data: { 'username' : username } //for now just pass username
    }).done(function(response){  //Attach a succes handler
    alert(response); //my complete code in validate.html
                     // displays in this alert!
    }); 
  }); 
}

 </head>
 <body>
   <form action="crud.html" method="post" name="form_submit" onsubmit="return validateLogIn()">
      <input required placeholder="Username" type="text" name="username" id="username"/>
      <input required placeholder="Password" type="password" name="password" id="password"/>
      <label for="remember">Remember Me:</label>
    <input type="checkbox" name="remember" value="yes" id="remember" />
    <br />
    <br />
    <input type="submit" name="login" value="login" id="login"/>
</form>

in validate.html: none of this gets executed

 <?php
  echo htmlspecialchars($_POST['username'], ENT_QUOTES, 'UTF-8');
  echo $username = $_POST['username']; 
  <script type='text/javascript'>alert('$username');</script>
</div>

I don't think you understand AJAX at all. I've made an example below very basic with comments.

var username  = $("#username").val();

$.ajax({     
    url: 'validate.php',  // << You can't have php in html files. 
    type: 'POST', // POST/GET
    data: { 'username' : username } //Data to be send will be in $_POST
  }).done(function(response){  //Attach a succes handler
     alert(response); //Alert the response from validate.php
  }); 
}

PHP FILE:

<?php
echo htmlspecialchars($_POST['username'], ENT_QUOTES, 'UTF-8'); //XSS PREVENTION