Commit 465cef80 by Patryk Czarnik

Pobieranie JSONa w jQuery

parent 0125c32c
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Title</title> <title>Title</title>
<script src="jquery-3.7.1.min.js"></script> <script src="jquery-3.7.1.min.js"></script>
<script> <script>
$(document).ready(function(event) { $(document).ready(function(event) {
alert("Start") $.getJSON("/rest/products", function( data ) {
// console.log(data)
data.forEach((product) => {$("#produkty").append("<p> " + product.productName + " za cenę " + product.price + "</p>")})
});
}) })
</script> </script>
</head> </head>
<body> <body>
<h1>Stronka ze skryptem</h1> <h1>Stronka ze skryptem</h1>
<div id="produkty">
</div>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment