title: Editing a row using an Ajax request
body: <p>Here I have shown 4 files I am using to edit rows of table by taking data from the database.</p>
  
  <p>First file is DataAdministration.php. when loading this file #Loading_Page7 should be shown and after clicking on #EditForms I need to show #Loading_Page8 div. At the moment when it is displaying for the first time I need to load DisplayData.php inside to #Loading_Page8 div. To support that I have used Update.js file. After loading DisplayData.php I need to edit a selected row by clicking on the edit link. Then the editable input box needed to be display in the relevant FormName column. Instead of writing them in the same file I need to use separate files like I have used here. But after clicking on edit link ajax request is not sent to the UpdateData.php file. </p>
  
  <p>I'm working with this for many days but couldn't fix it yet. This is quite a long question. But please someone be kind enough to show my mistake. </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type='text/javascript' src='Update.js'&gt;&lt;/script&gt;
  
          &lt;script src="jquery-1.10.2.min.js"&gt;&lt;/script&gt;
          &lt;script&gt;
              $(document).ready(function(){
                  $("#Loading_Page8").hide();
  
                  $("#EditForms").click(function(){
                      $("#Loading_Page7").hide();
                      $("#Loading_Page8").show();
                      ABC();
                      C();
                      return false;
                  });
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;          
          &lt;div id="Loading_Page7" &gt;
              &lt;div id="EditForms" class="AddUser"&gt;
                  &lt;li&gt;&lt;a href=""&gt;&lt;span&gt;Edit/Delete Forms&lt;/span&gt; &lt;/li&gt;&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div id="Loading_Page8"&gt;
              &lt;div class="User" style="color:#0B173B"&gt;Forms_Available_to_Collect_Pubic_Health_Information &lt;/div&gt;
  
              &lt;div id="DisplayFormDetails" style="position:absolute; top:100px; width:1000px;"&gt; 
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;                  
  </code></pre>
  
  <p>This is the Update.js file</p>
  
  <pre><code>function ABC(){
      $.ajax({    //create an ajax request to load_page.php
          type: "GET",
          url: "DisplayData.php",             
          dataType: "html",   //expect html to be returned                
          success: function(response){                    
              $("#DisplayFormDetails").html(response); 
              //alert(response);
          }
      });
      C();
  }
  
  function C() {
      $(".FormEdit").click(function(){
          var B=$(this).attr('id');//ID comming is FormEdit3. And now B==4
          var NumericValue=B.replace("FormEdit","");
  
          $.ajax({
              type:"POST",
              url:"UpdateData.php",
              data:{ NumericValue : NumericValue },
              success:function(data){
                  $("#FormName"+NumericValue).html(data);
              },
              error: function (err){ 
                  alert(err.responseText)
              }
          });
      });
  }
  </code></pre>
  
  <p>This is DisplayData.php</p>
  
  <pre><code>&lt;?php
      include 'connectionPHP.php';
  
      $result=mysqli_query($con,"SELECT * FROM Form");
      echo "&lt;table border='1' &gt;
          &lt;tr style='background-color:#D0A9F5;' height='40px;'&gt;
              &lt;th width='100px;'&gt;Form ID&lt;/th&gt;
              &lt;th width='420px;'&gt;Form Name&lt;/th&gt;
              &lt;th width='70px;'&gt;Edit&lt;/th&gt;
          &lt;/tr&gt;";
  
      $i=1;
      while($row = mysqli_fetch_array($result)) {         
          $w=$row['Form_ID'];
          echo "&lt;tr height='25px;'&gt;";
          echo "&lt;td name='FormID' id='FormID ".$i."' align=center&gt;$row[Form_ID] &lt;/td&gt;";
          echo "&lt;td name='FormName' id='FormName".$i."' align=left&gt;$row[Form_Name]&lt;/td&gt;";
          echo "&lt;td class='FormEdit' id='FormEdit".$i."' align=center&gt;&lt;a href='' align=left&gt;Edit&lt;/a&gt;&lt;/td&gt;";
  
          echo "&lt;/tr&gt;";
          $i++;
      }
  
      echo "&lt;/table&gt;";                
  ?&gt;
  </code></pre>
  
  <p>And Finally UpdateData.php file.</p>
  
  <pre><code>&lt;?php
      include 'connectionPHP.php';
  
      if(isset($_POST['NumericValue'])) {
          $uid = $_POST['NumericValue'];
  
          echo $uid;
  
          $query ="SELECT * FROM Form WHERE Form_ID='$uid' ";
          $FetchResults=mysqli_query($con,$query);
          while($row=mysqli_fetch_array($FetchResults)) {
              $FormName=$row['Form_Name'];
              echo '&lt;input type="text" value="$FormName"&gt;&lt;/input&gt;';
          }       
      }
  ?&gt;
  </code></pre>