1
私が助けてくれますか?新しいdivを Iv got this one. All is going into one divjQueryのgetJSONのコンテンツを新しいdiv
に私のデータをロードする方法And how to make right that
イムだけでどのように作るかを尋ね:
[
{
"name":"wat1",
"number":"42306810738002982912",
"city":"mat1",
"amount":"50 000,00",
"currency":"qwe1",
"rate":"7,40%"
},
{
"name":"wat2",
"number":"42306840338002521455",
"city":"mat2",
"amount":"153,85",
"currency":"qwe2",
"rate":"2,85%"
},
{
"name":"wat3",
"number":"42307752138002500019",
"city":"mat3",
"amount":"1500,00",
"currency":"qwe3",
"rate":"0,01%"
}
]
:divのは、JSONファイルに応じて、自動的に(データ量)
私のJSONを作成する必要があります
スクリプト:
$(document).ready(function(){
$.getJSON("accounts.json", function(data){
$.each(data, function(key, value){
$("name").append(value.name)
$("number").append(value.number)
$("city").append(value.city)
$("amount").appoend(value.amount)
$("currency").append(value.currency)
$("rate").append(value.rate);
});
});
});
とhtml:
<div class="deposit-small-block first-block size-small-block tt" onclick="view('t1'); return false">
<div class="button_block">
<div class="div-for-button">
<input type="radio" name="on">
</div>
</div>
<div class="deposit-form-block-name">
<div class="deposit-form-block-name-first white-text"><name></name></div>
<div class="deposit-form-block-name-second white-text"><number></number></div>
<div class="deposit-form-block-name-third white-text"><city></city></div>
</div>
<div class="deposit-form-block-sum">
<div class="deposit-form-block-sum-text white-text">
<amount></amount><br><currency></currency>
</div>
</div>
<div class="deposit-form-block-perc">
<div class="deposit-form-block-sum-text white-text"><rate></rate></div>
</div>
</div>
[リンク](https://drive.google.com/file/d/0B6ov-TJi--Z8OEVvZWdPR0hoMTA/view?usp=sharing )何か間違っているか、私は間違いを見ることができません。 – Serejqa
私は誤った箇所を確認できます。 divとデータをロードできません – Serejqa
コードが更新されました.JSON.parse(data)を使用する必要があります。現在は –