Try this I am getting data from this(试试这个我从这里获取数据)
var url = "https://api.nytimes.com/svc/search/v2/articlesearch.json"; url += '?' + $.param({ 'api-key': "11111111111111111111111" }); $.ajax({ url: url, method: 'GET', dataType: 'JSON', success: function(data) { console.log(data) }, error: function(err) { console.log('error:' + err) } })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
you can also try like as follows(您也可以尝试如下)
var url = "https://api.nytimes.com/svc/search/v2/articlesearch.json"; $.ajax({ url: url, method: 'GET', dataType: 'JSON', data: { 'api-key': '11111111111111111' }, success: function(data) { console.log(data) }, error: function(err) { console.log('error:' + err) } })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…