terserah's blog

By terserah, history, 9 years ago, In English

Hello. I'd like to ask how to request CF API using AJAX. Here is my code :

$.ajax({
       type : "GET" , 
       url : "http://mirror.codeforces.com/api/problemset.problems?tags=implementation",
       success : function(data) {
           alert("success");
       } , 
       error : function(data) {
           alert('fail');
       }
});

The AJAX call returns nothing. How do I solve this issue? Thanks!

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by terserah (previous revision, new revision, compare).

»
9 years ago, # |
  Vote: I like it +12 Vote: I do not like it

If you're using something newer than IE6 then open a debug panel and check the error there. Probably you have cross-domain call rejected. Read about JSONP in the CF API guide.