Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.91 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <body>
  4.  
  5. <button>Send request</button>
  6. <pre></pre>
  7.  
  8. <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
  9. <script type="text/javascript">
  10.     var username = 'ShopAccount.IWNetIneco\\test';
  11.     var password = 'test';
  12.     var precode = 'F';
  13.     var code = '136258';
  14.  
  15.     var url = 'http://ineco.synology.me/IWNet/ShopService.svc/GetAvailabilityA?precode=\'' + precode + '\'&code=\'' + code + '\'&deposit=\'01\'&$format=json';
  16.  
  17.     $(document).ready(function() {
  18.         $('button').click(function() {
  19.             $('pre').html('loading...');
  20.             $.ajax({
  21.                 dataType: 'json',
  22.                 url: url,
  23.                 type: 'GET',
  24.                 withCredentials: true,
  25.                 headers: {
  26.                     Authorization: 'Basic ' + btoa(username + ':' + password)
  27.                 }
  28.             }).done(function(data) {
  29.                 $('pre').html(JSON.stringify(data));
  30.             }).fail(function(err) {
  31.                 $('pre').html(err.responseText);
  32.             });
  33.         });
  34.     });
  35.  
  36. </script>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement