2017-06-11 1 views
1

に失敗し、私はすでに正常ここでスコア値入力から基づいて、スコア値取得しようとするが、これを尋ねる前

をつかむしようとする私のスクリプトは、それがうまくつかむ

<script> \t \t 
 
    $.ajax({ 
 
     type: "POST", 
 
     url: "https://example.com/paylist.php?acc=useraccount&json=1", 
 
     dataType: "JSON", 
 
     success: function (data) { 
 
      $('#total').text(data.pending[0].pending); 
 
     } 
 
    }); 
 
</script>

ですdata.pending[0].pending 私のブログ訪問者が自分のアカウントのスコアを得るために入力ボックスを作ってみたいが、失敗した。

私はここで

<script> \t \t 
 
function onClaim(token) { 
 
    $.ajax({ 
 
     type: "POST", 
 
     url: "https://example.com/paylist.php? 
 
         acc='+useraccount+'&json=1", 
 
     dataType: "JSON", 
 
     success: function (data) { 
 
      $('#total').text(data.pending[0].pending); 
 
     } 
 
    }); 
 
}

に私のスクリプトを変更するには、私の入力ボックスと検索ボタン

<div> 
 
<input required="" type="text" style="width: 90%; max-width: 600px; text- align: center;" name="useraccount" id="useraccount" placeholder="Your account" value=""> 
 
</div> 
 
<div> 
 
<button style="display: block; margin-left: auto; margin-right: auto;" id="findbutton" data-callback="onClaim">Find</button> 
 
</div> 
 
<center><a style="color: rgb(102, 102, 102);">score: </a><span id="total" style="color: rgb(102, 102, 102);"></span></center>

は私がしようとしたとき、私はすべてのエラーメッセージが表示されますdidntはありますそれを実行しています。

私の悪い英語を申し訳ありません。

+0

なぜ '>'次の '> acc'のparam –

答えて

0

最初var useraccount = $("#useraccount").val();

、あなたのAJAXのURLは以下のようにする必要がありますUserAccountの値を取得する:

url: "https://example.com/paylist.php?acc="+useraccount+"&json=1", 
+0

は病気にこれを試して、感謝 –

+0

に答えるために私のコード上の '>'はこのサイトに投稿しようとすると入力ミスです –

+0

最後のhtml行を次のように置き換えてください:

score:

関連する問題