title: Jquery AJAX post to PHP not work
body: <p>This is jquery</p>
  
  <pre><code>$(document).ready(function () {
      $('#Main').change(function () {
          var Sel = $(this).val();
          console.log(Sel);
          $(".Subselect").hide();
          $(".lastSel").hide();
          $("#" + Sel).show();
          $.ajax({
              type: "POST",
              url: "test.php",
              data: "id=" + Sel + "&amp;part_id="+$(this).attr('name'), //part_id = region
              success: function(data) {
                  $(".region").html(html);
              }
             });
      });
      $('.Subselect').change(function () {
          var subSel = $(this).val();
          console.log(subSel);
          $(".lastSel").hide();
          $("#" + subSel).show();
          $.ajax({
              type: "POST",
              url: "test.php",
              data: "id=" + subSel + "&amp;part_id="+$(this).attr('name'), //part_id = city
              success: function(data) {
                  $(".city").html(html);
              }
             });
      })
  });
  </code></pre>
  
  <p>This is mysql table</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `s_countries` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
    `name` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
    PRIMARY KEY (`id`),
    KEY `id_name` (`name`),
    KEY `id_code` (`code`)
  ) ENGINE=MyISAM;
  
  CREATE TABLE IF NOT EXISTS `s_regions` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `countryid` int(11) unsigned NOT NULL DEFAULT '0',
    `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
    PRIMARY KEY (`id`),
    KEY `id_countryid` (`countryid`),
    KEY `id_name` (`name`)
  ) ENGINE=MyISAM;
  
  CREATE TABLE IF NOT EXISTS `s_cities` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `countryid` int(11) unsigned NOT NULL DEFAULT '0',
    `regionid` int(10) unsigned NOT NULL DEFAULT '0',
    `name` varchar(128) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
    PRIMARY KEY (`id`),
    KEY `id_name` (`name`),
    KEY `id_regionid` (`regionid`),
    KEY `id_countryid` (`countryid`)
  ) ENGINE=MyISAM;
  </code></pre>
  
  <p>This is mailtest.php (i tried many options, but cat do it work) here is example in (html + Jquery <a href="http://jsfiddle.net/Nazaret2005/bPUbb/" rel="nofollow">http://jsfiddle.net/Nazaret2005/bPUbb/</a></p>
  
  <pre><code>&lt;?
  require "include/db.php";
  dbconn(true);
  loggedinorreturn(true);
  
  
  echo "&lt;form method=\"POST\"&gt;";
  $cat = "&lt;select id='Main' name='country'&gt;";
  $cat .= "&lt;option value='0'&gt;Выбрать&lt;/option&gt;";
  $results = do_mysql_query("SELECT id, code, name FROM s_countries") or sqlerr(__FILE__, __LINE__); 
  while($c = mysqli_fetch_array($results)){
  $cat .= "&lt;option value='".$c['id']."'&gt;".$c['name']."&lt;/option&gt;";
  }
  $cat .= "&lt;/select&gt;";
  echo $cat;
  echo "&lt;select name='region' class='Subselect'&gt;";
  echo "&lt;option value='0'&gt;-Выбрать-&lt;/option&gt;";
  echo "&lt;/select&gt;";
  ?&gt;
  </code></pre>
  
  <p>and this is test.php</p>
  
  <pre><code>&lt;?
  require_once("include/db.php");
  dbconn(true);
  
  if(isset($_POST['id'])){
  $id=(int)$_POST['id'];
  $res = do_mysql_query("SELECT id, name FROM s_regions WHERE countryid = '".$id."'") or sqlerr(__FILE__, __LINE__); 
  if(mysqli_num_rows($res) &gt; 0){
  while($r = mysqli_fetch_array($res)){
  echo "&lt;option value='".$r['id']."'&gt;".$r['name']."&lt;/option&gt;";
  }
  } }
  
  ?&gt;
  </code></pre>
  
  <p>I wanna do this work with database like in html example <a href="http://jsfiddle.net/Nazaret2005/bPUbb/" rel="nofollow">http://jsfiddle.net/Nazaret2005/bPUbb/</a> , countries, regions and cities.
  But i can't do it work....</p>
  
  <p>If it's ease for some one. please help to do it work. thanks</p>