We are trying to user ajax to make a call to a webservice - Authentication/Validate but so far, it can't find the webservice.
Each time you run the script, you get, "error", just error.
The webservice is on a different web server while the ajax script calling it is on another server.
However, they are both on port 80 and on same domain.
I have been struggling with this for 2 days.
Script is below.
Thanks alot in advance
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$.ajax({
url:"Authentication/Validate",
data: { data: JSON.stringify({ LoginName: "jane.doe",Password: "jdoe" }) },
success: function (data) {
alert("found!");
debugger;
var token = JSON.parse(data);
},
error: function(a,b,c) {
alert(b+"\n"+c)
},
dataType:"json"
});
</script>
</head>
<body></body>
</html>
param=data: {"LoginName":"jane.doe","Password":"jdoe"}
Response body: SyntaxError: JSON.parse: Unexpected end of data