Last active
August 29, 2015 14:08
-
-
Save ngnguyen1/9d77d87def10a674dd75 to your computer and use it in GitHub Desktop.
index file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="nga.js"></script> | |
| </head> | |
| <body> | |
| <div id="txtCDInfo"> | |
| <button onclick="loadXMLDoc()">Get from locations</button> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loadXMLDoc() | |
| { | |
| var url = 'http://bus.hlink.vn/webservice/NuSoapServer.php?wsdl'; | |
| var soapaction = 'GetStation'; | |
| var service_id = 1; | |
| var xmlhttp = new XMLHttpRequest(); | |
| var sr = | |
| '<\?xml version="1.0" encoding="utf-8"\?>' + | |
| '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' + | |
| '<SOAP-ENV:Body>' + | |
| '<'+soapaction+'>' + | |
| '<service_id>'+service_id+'</service_id>' + | |
| '</'+soapaction+'>' + | |
| '</SOAP-ENV:Body>' + | |
| '</SOAP-ENV:Envelope>'; | |
| xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8'); | |
| xmlhttp.send(sr); | |
| xmlhttp.onreadystatechange = function () { | |
| if (xmlhttp.readyState == 4) { | |
| if (xmlhttp.status == 200) { | |
| console.log(xmlhttp.responseText); | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment