フィルターのクリア

Read Five Entries from private channel in json format no working

2 ビュー (過去 30 日間)
Gcobani Mkontwana
Gcobani Mkontwana 2019 年 11 月 11 日
コメント済み: SHUAI TAN 2021 年 8 月 19 日
Hi Team
I have this Ajax call request, it seem it does not working on my button to download date range, Strange part when i access this URL directly from the browser it can download this file format as CVS file on my local computer, Any idea as to why am i not able to get this write? Kindly please help, thanks. https://nl.mathworks.com/help/thingspeak/readdata.html
$(document).ready(function() {
$("#download").click(function() {
$.ajax({
url:'https://www.thingspeak.com/channels/899906/feeds.csv?api_key=F**&results=3',
type:'POST',
dataType:'json',
success:function(response){
window.location = response;
}
});
});
});

採用された回答

Gcobani Mkontwana
Gcobani Mkontwana 2019 年 11 月 11 日
Well after so much troubleshooting, i have managed to work around on two things. See my solution as i was looking for all along.
$(document).ready(function() {
$("#download").click(function() {
$.ajax({
url:'https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-08%2019:10:08&end=2019-11-11%2019:11:11',
crossDomain:true,
type:'GET',
data:{
format:'csv',
},
success:function(response){
window.location.href ='https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-08%2019:10:08&end=2019-11-11%2019:11:11' ;
},
error:function() {
$().text("There was an error processing your request.Please try again");
}
});
});
});
  1 件のコメント
SHUAI TAN
SHUAI TAN 2021 年 8 月 19 日
bro 2019-11-08%2019:10:08
"%20"? stands for time zone? and which time zone referring to ?

サインインしてコメントする。

その他の回答 (0 件)

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeJSON Format についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by