OSDN Git Service

実ゆっくりに向きを追加。次回は左向きのときの座標あわせを行う。TODO要確認
[yukkurioverwint/YukkuriOverwinter.git] / net.js
1 function Net(){
2 }
3 Net.prototype.load = function(url){
4         var data = null;
5         $.ajax({
6                 // type: 'GET',
7                 url: url,
8                 dataType: 'json',
9                 async : false,
10                 success : function(_data, _status){
11                         //通信が成功した場合の処理 (JSONPのコールバック関数はこれが呼ばれます)
12                         // console.log("success");
13                         data = _data;
14                 },
15                 error: function(data){
16                         // console.log("error");
17                         // console.log(data);
18                 },
19                 complete : function(XMLHttpRequest, textStatus){
20                         // console.log("complete");
21                         //通信終了時の処理
22                         // console.log(XMLHttpRequest);
23                         // console.log(textStatus);
24                         if(textStatus != "success"){
25                                 // throw "Bad json format";
26                         }
27                 }
28         });
29         return data;
30 };