Hello I am trying to make quote generating machine and I am reading quotes from forismatic api and it getQuote method. I am new to this and I have tried .getJSON and .get method but I always get error. Can someone please tell me what am I doing wrong in reading from server? Once I have read it how to I put it onto html and how do I debug in such situations. So far I have done this
JS file
$("document").ready(function() {
var request = $.ajax({
url: "http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=xml&lang=en?",
method: "GET",
dataType: "json"
});
request.done(function(msg) {
$("#log").html(msg);
});
request.fail(function(jqXHR, textStatus) {
alert("Request failed: " + textStatus);
});
});
HTML file
<head>
<title>Random Quote Machine</title>
</head>
<body>
<div class="jumbotron">
<div class="container-fluid">
<div class="page-header text-center">
<h1>Random Quote Machine</h1>
<p class="result bg-primary">Quote Goes here</p>
<button class="btn btn-primary type="button">Generate Quote</button>
</div>
</div>
</div>
</body>
thanks and sorry if i did something wrong