POST 500(内部服务器错误)

I'm working on a Python app that uses jQuery to smart-select districts when the correct city is selected and cities when the correct country is selected, so visitors need not refresh their browser.

I get this error on Chrome console:

POST [Localhost url] 500 (Internal Server Error)

Here is my testing code:

   <header>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" /> 
      <script>
         function selectCountry(){
            $.ajax({
               type: 'POST',
               url: '/',
               data: 'countrySelect=1',

            });
            console.log(events);
         }

      </script>
   </header>

   <body>
      <script>
         var var1 = $_POST('countrySelect');
         document.write(var1);
      </script>

      <select onchange="javascript:selectCountry()">
         <option name="" value="">country a</option>
         <option name="" value="">country b</option>
      </select>
  </body>

Changing to GET works fine but doesn't show the variables on the navigation bar.

Can anyone help?

Thanks in advance.

Changing to GET would not show the variable on the nav bar because its an ajax request. To troubleshoot this use fiddler (or your browser's session inspector) to see the actual request. I would also change the data to a json object such as { countrySelect:"1" }