I have a problem with getting a JSON object from a server. The PHP returns a JSON file.
The script always fails and I have no idea why. The PHP when ran in a browser returns this;
{"accountDetails":[{"account_name":"SOMEACCOUNT","auto_id":"1"}
My code:
<div id="output"> This should change </div>
<script>
$(document).ready(function () {
$.ajax({
type: 'GET',
url: 'selectAccounts.php',
data: "",
dataType: 'json',
success: function ()
{
$("#output").text("SUCEEDED");
},
error: function () {
$("#output").text("UNSUCEEDED");
}
});
});
</script>