Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.76 KB | None | 0 0
  1.  
  2. <html>
  3.   <head>
  4.     <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
  5.     <script type="text/javascript">
  6.       $(document).ready(function() {
  7.         $.ajax({
  8.           url: 'http://127.0.0.1/api/plugin/mysimpleapiplugin',
  9.           type: 'GET',
  10.           dataType: 'json',
  11.           data: 'command:command3, data:data',
  12.           success: function() { alert('hello!'); },
  13.           error: function() { alert('boo!'); },
  14.           beforeSend: setHeader
  15.         });
  16.       });
  17.  
  18.       function setHeader(xhr) {
  19.         xhr.setRequestHeader('X-Api-Key', '65299B7128094CF787E1998F09DF0D88');
  20.         xhr.setRequestHeader('Content-Type', 'application/json');
  21.       }
  22.     </script>
  23.   </head>
  24.   <body>
  25.     <h1>Some Text</h1>
  26.   </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement