Skip to content

Instantly share code, notes, and snippets.

@ngnguyen1
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save ngnguyen1/9d77d87def10a674dd75 to your computer and use it in GitHub Desktop.

Select an option

Save ngnguyen1/9d77d87def10a674dd75 to your computer and use it in GitHub Desktop.
index file
<!DOCTYPE html>
<html>
<head>
<script src="nga.js"></script>
</head>
<body>
<div id="txtCDInfo">
<button onclick="loadXMLDoc()">Get from locations</button>
</div>
</body>
</html>
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