var quoteUrl='http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json';
$(document).ready(function() {
var $loader = $("#btn"),
$insertion=$("#insertionPoint");
$loader.click(function() {
$.ajax({
url:quoteUrl ,
dataType: 'json',
success:function(data){
var quote=data.quoteText;
$insertion.replaceWith('<p>'+quote+'</p>');
}
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>Random quote Machine</h1>
<div id="insertionPoint">
<p>Quotes come here</p>
</div>
<button id="btn">Next Quote</button>
Задача: Чтобы получить цитату из forimastic.com-х Апи
Результат: Ничего не Happening
Дополнительно: Как я могу добавить коды, чтобы сделать это получить случайные кавычки, если это работает?
попробовать '$ ($ погрузчиком) .click' – Phiter
$ ($ Загрузчик) .click (функция() {......}) ; Нет не работает – Nibesh