Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Demo</title>
- </head>
- <body>
- <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
- <script>
- $( document ).ready(function() {
- $( "#but1" ).click(function( event ) {
- // 127.0.0.1:8080 - Адрес, который слушает наш сервер.
- // cmd и LabelData - POST data, которая передаётся серверу при запросе.
- $.post( "http://127.0.0.1:8080/", { cmd: "PrintLabel", LabelData: "template=label4;barcode=1234567890;text=MyTestItem" })
- .done(function( data ) {
- if ( data == "_print_ok" ) {
- alert("Print command - success");
- } else {
- alert("Print command failed: " + data);
- }
- });
- });
- $( "#but2" ).click(function( event ) {
- $.post( "http://127.0.0.1:8080/", { cmd: "ClearQueue", printer: "default" })
- .done(function( data ) {
- if ( data == "_clear_ok" ) {
- alert("Clear command - success");
- } else {
- alert("Clear command failed: " + data);
- }
- });
- });
- });
- </script>
- <input type="button" value="Print" id="but1" />
- <input type="button" value="Clear Printing queue" id="but2" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement