Commit 465cef80 by Patryk Czarnik

Pobieranie JSONa w jQuery

parent 0125c32c
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<script src="jquery-3.7.1.min.js"></script>
<script>
$(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>
</head>
<body>
<h1>Stronka ze skryptem</h1>
<div id="produkty">
</div>
</body>
</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