So i'm trying to make a simple ajax call to retrieve some data from a file on a server. I can access the file through the web browser, and i've followed tutorials on this subject to the T, but it has gotten me nowhere. Here is the javascript code:
<script type="text/JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
type: "POST",
url: "https://www.mychoicetechnologies.com/Services/FMSUtilities.asmx/GetServerDate",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg)
{
document.getElementById('area').innerHTML = "Success! Retrieved a server response using AJAX.";
},
error: function (xhr, status, error)
{
document.getElementById('area').innerHTML = "1." + error + "<br>";
document.getElementById('area').innerHTML += "2." + xhr + "<br>";
document.getElementById('area').innerHTML += "3." + status + "<br>";
document.getElementById('area').innerHTML += "The script has failed";
}
});
</script>
When I run this script the output is:
1.
2.[object Object]
3.error
The script has failed.