Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
- <script>
- var body = '<?xml version="1.0" encoding="UTF-8"?> '
- + '<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"> '
- + ' <ServiceRequest> '
- + ' <siri:RequestTimestamp>2016-06-27T13:34:00</siri:RequestTimestamp> '
- + ' <siri:RequestorRef>EPSa</siri:RequestorRef> '
- + ' <RequestPayload> '
- + ' <StopEventRequest> '
- + ' <Location> '
- + ' <LocationRef> '
- + ' <StopPointRef>8502113</StopPointRef> '
- + ' </LocationRef> '
- + ' <DepArrTime>2017-01-03T10:22:00</DepArrTime>'
- + ' </Location> '
- + ' <Params> '
- + ' <NumberOfResults>1</NumberOfResults> '
- + ' <StopEventType>departure</StopEventType> '
- + ' <IncludePreviousCalls>true</IncludePreviousCalls> '
- + ' <IncludeOnwardCalls>true</IncludeOnwardCalls> '
- + ' <IncludeRealtimeData>true</IncludeRealtimeData> '
- + ' </Params> '
- + ' </StopEventRequest> '
- + ' </RequestPayload> '
- + ' </ServiceRequest> '
- + '</Trias> ';
- $(document).ready(function() {
- $('button').click(function() {
- $.ajax('https://odpch-api.begasoft.ch/trias-stackoverflow', {
- method: 'POST',
- headers: {
- 'Content-Type': 'text/xml',
- 'Authorization': '57c5dadd5e6307000100005e4365c41fa4d946a44ecbd19508fbef64'
- },
- data: body,
- dataType: 'text'
- }).done(function(data) {
- $('#response').text(data);
- });
- });
- });
- </script>
- </head>
- <body>
- <button>Ajax</button>
- <div id="response"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement