G
G
gl_t2018-03-03 19:38:31
JavaScript
gl_t, 2018-03-03 19:38:31

Why doesn't jQuery work?

Uncaught ReferenceError: jQuery is not defined at (index):23

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>test</title>
  <link rel="stylesheet" type="text/css" href="style.css">
  <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
  <form method="post" action="#">
  <input type="text" name="producer" class="producerField" placeholder="Производитель">
  <input type="text" name="name" class="nameField" placeholder="Наименование">
  <input type="text" name="price" class="priceField" placeholder="Цена">
  <input type="text" name="amount" class="amountField" placeholder="Количество">
  <input type="submit" value="Добавить" class="button">
  </form>

  <table class="row" style="border:2px solid silver">
    
  </table>

<script>
JQuery(document).ready(function() {
  JQuery(".button").bind("click", function() {

    var producer = JQuery('.producerField').val();
    var name = JQuery('.nameField').val();
    var price = JQuery('.priceField').val();
    var amount = JQuery('.amountField').val();


    JQuery('.producerField').val('');
    JQuery('.nameField').val('');
    JQuery('.priceField').val('');
    JQuery('.amountField').val('');

    JQuery.ajax({
      url: "data.php",
      type: "POST",
      data: {producer:producer, name:name, price:price, amount:amount},
      dataType: "json",
      success: function(result) {
        if (result){
          JQuery('.rows').append(function(){
            var res = '';
            for(var i = 0; i < result.products.producer.length; i++){
              res += '<tr><td>' + result.product.producer[i] + '</td><td>' + result.product.name[i] + '</td><td>' + result.product.price[i] + '</td><td>' + result.product.amount[i] +
              '</td><tr>'; 
 						}
 						return res;
          });
          console.log(result);
        }else{
          alert(result.message);
        }
        return false;
      }	
    });
  return false
  });
});
</script>
</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2018-03-03
@gl_t

Case matters
5a9ad67dcfaeb488101779.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question