i have restful webService and I want to call websrevice using javaScript , So when i tried with xml file like var url = "xx.xml"; it success
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head runat="server">
<title></title>
<script language="javascript">
var xmlhttp;
function init() {
xmlhttp = new XMLHttpRequest();
}
function getdetails() {
var url = "xx.xml";
init();
xmlhttp.open('GET', url, true);
xmlhttp.send(null);
xmlhttp.onreadystatechange = function () {
alert(xmlhttp.readyState);
alert(xmlhttp.status);
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var det = xmlhttp.responseText;
alert(det);
}
else
alert("Error ->" + xmlhttp.responseText);
}
};
}
getdetails();
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
but when I use url of webservice like
var url = "http://localhost:3085/BasicService.svc/sess_details?session=1000"; it doesn't work . the value of xmlhttp.status is 0
remark when I put url in browser the information appear in xml style such as xx.xml file .
No comments:
Post a Comment