title: Php productcode Entered Probelm
body: <p>if i enter the correct product code relavent  details should show.if i remove the productcode details should remove. i attached the screenshot image below.
  if i remove the productcode still details should shown. what i tried so far i attached below.
  <a href="https://i.stack.imgur.com/sPLb8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sPLb8.jpg" alt="enter image description here"></a></p>
  
  <pre><code>    function getProductcode() {
          $("#barcode").empty();
          $("#barcode").keyup(function(e) {
              var q = $("#barcode").val();
              $.ajax({
                  type: "POST",
                  url: "get_product.php",
                  dataType: "JSON",
                  data: { barcode: $("#barcode").val() },
                  success: function(data) {
                      if (data != null) {
  
                          is_product = true;
                          $("#pname").val(data[0].p_name);
                          $("#pro_price").val(data[0].retail_price);
                          $("#qty").focus();
                          $('#barcode').parent('div').removeClass('has-error');
                          $('#price').html('');
                      }
  
                      else
                      {
  
                          $('#barcode').parent('div').addClass('has-error');
                          is_product = false;
                          $("#pname").val('');
                          $("#pro_price").val('');
  
                          $('#qty').val('1');
                      }
  
  
  
  
          });
  }
  </code></pre>
  
  <p>html </p>
  
  <pre><code>        &lt;td&gt;
                      &lt;div class="focusguard" id="focusguard-1" tabindex="1"&gt;&lt;/div&gt;
                      &lt;input type="text" tabindex="2" class="form-control" placeholder="barcode" id="barcode" name="barcode"  required&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                  &lt;label id="pro_name" name="pname" id="pname"&gt;&lt;/label&gt;
                   &lt;input  type="text" class="form-control" placeholder="barcode" id="pname" name="pname" disabled&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" class="form-control pro_price" id="pro_price" name="pro_price"
                         placeholder="price" disabled&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="number" class="form-control pro_price" id="qty" name="qty"
                         placeholder="qty" min="1" value="1"  required&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" class="form-control" placeholder="total_cost" id="total_cost" name="total_cost" disabled&gt;
              &lt;/td&gt;
  </code></pre>