Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Sugestie jQuery</title>
- <script src="jquery-3.4.1.js"></script>
- <script type="text/javascript">
- function wyslijAJAX() {
- var parametry = {
- "pole": $('#manufacturer').val(),
- "wartosc": $('#manufacturer').val()
- }
- var parametr = new Object();
- parametr.wartosc = $('#manufacturer').val();
- if(parametry.wartosc){
- $.ajax({
- url: "suggestionXML",
- type: "POST",
- dataType: "json",
- data: JSON.stringify(parametry),
- contentType: "application/json",
- mimeType: "application/json",
- success: function(data) {
- alert("data: " +data)
- },
- error: function(data, status, er){
- alert("error: "+data+
- +" status: "+status+
- " error: " + er)
- }
- })
- }
- }
- </script>
- </head>
- <body>
- <h4>Podaj marke samochodu</h4>
- <input id="manufacturer" type="text" onkeyup="javascript:wyslijAJAX()">
- <div id="result"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement