2017-03-06 13 views
0

私のアプリケーションは静的な翻訳が必要です。私はjsonファイルに翻訳を入力しました。 jsファイルがロードされる前に、このjsonファイルをロードします。どうしたらいいですか?どんな助けもありがとう。jsファイルの前にjsonファイルをロード

+1

あなたが何をしようとしたのですか? –

+0

@Nikhilバックエンド言語を使用していますか?例えばphp。 –

+0

'functions.js'の前に' json.js'ファイルを含めてください。 – domsson

答えて

0
$(function(){ 

    $.ajax({ 

     dataType: "json", 

     url: 'path/to/json/file.json', 

     success: function(result){ 

     // you can process the JSON result first 
     // and call other functions after this point 

     } 

     }); 

    }); 
0

あなたはこのような何かを行うことができます。

$(function(){ 
 
    $.ajax({ 
 
    dataType: "json", 
 
    url: 'path/to/json/file.json', 
 
    success: function(result){ 
 
     start(result) 
 
    } 
 
    }); 
 
}); 
 
function start(data /*converted to javascript object*/){ 
 
    // you can process the JSON result first 
 
    // and call other functions after this point 
 
}

関連する問題