Advertisement
Guest User

Untitled

a guest
Jan 13th, 2017
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.07 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>Title</title>
  6.   <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  7.   <script>
  8.     var body = '<?xml version="1.0" encoding="UTF-8"?> '
  9.     + '<Trias version="1.1" xmlns="http://www.vdv.de/trias" xmlns:siri="http://www.siri.org.uk/siri" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> '
  10.     + '    <ServiceRequest> '
  11.     + '        <siri:RequestTimestamp>2016-06-27T13:34:00</siri:RequestTimestamp> '
  12.     + '        <siri:RequestorRef>EPSa</siri:RequestorRef> '
  13.     + '        <RequestPayload> '
  14.     + '            <StopEventRequest> '
  15.     + '                <Location> '
  16.     + '                    <LocationRef> '
  17.     + '                        <StopPointRef>8502113</StopPointRef> '
  18.     + '                    </LocationRef> '
  19.     + '                    <DepArrTime>2017-01-03T10:22:00</DepArrTime>'
  20.     + '                </Location> '
  21.     + '                <Params> '
  22.     + '                    <NumberOfResults>1</NumberOfResults> '
  23.     + '                    <StopEventType>departure</StopEventType> '
  24.     + '                    <IncludePreviousCalls>true</IncludePreviousCalls> '
  25.     + '                    <IncludeOnwardCalls>true</IncludeOnwardCalls> '
  26.     + '                    <IncludeRealtimeData>true</IncludeRealtimeData> '
  27.     + '                </Params> '
  28.     + '            </StopEventRequest> '
  29.     + '        </RequestPayload> '
  30.     + '    </ServiceRequest> '
  31.     + '</Trias> ';
  32.  
  33.     $(document).ready(function() {
  34.       $('button').click(function() {
  35.         $.ajax('https://odpch-api.begasoft.ch/trias-stackoverflow', {
  36.           method: 'POST',
  37.           headers: {
  38.             'Content-Type': 'text/xml',
  39.             'Authorization': '57c5dadd5e6307000100005e4365c41fa4d946a44ecbd19508fbef64'
  40.           },
  41.           data: body,
  42.           dataType: 'text'
  43.         }).done(function(data) {
  44.           $('#response').text(data);
  45.         });
  46.       });
  47.     });
  48.   </script>
  49.  
  50. </head>
  51. <body>
  52. <button>Ajax</button>
  53. <div id="response"></div>
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement