<!DOCTYPE html>
<html lang="de">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo für Westnetz</title>
</head>
 
<script>
$(document).ready(function()
{

  $("button#search").on("click", function(e)
	{
 		$.ajax({
 	 		url: "http://localhost:8080/demoServer.php",
 	 		data: {"suche": "undefined"},

			success: function(data, e)
					{
					  $("input#vorname").val(data.vorname);			
					  $("input#edifact").val(data.edifact);
					  $("input#verbrauch").val(data.ablesung[0].ergebnis);		
					},
					
		    error: function(xhr, status, error)
		   		   {
		   		      alert(error);
		           },      		             	 		
 		});		
	});
});

</script>  
<body>
    <button id="search">Suchen</button>
    <input type="text" id="vorname">
    <input type="text" id="nachname">
    <input type="text" id="verbrauch">
    <input type="text" id="edifact">
</body>
</html>



