1

在提交成功时,表单返回一个 JSON 响应,我正在尝试将响应添加到单击标签[class]="wishstatus"但它被添加到所有标记,因为它在 PHP 循环中。
是否有任何解决方案可以将 JSON 响应添加到单击的标签..?

JSON 响应 {"message":"ADDED","type":2,"codez":"wishlistSelected"}

**AMP FORM**                    
    <form method="post" id="courseTap" action-xhr="" target="_top" on="submit-success: 
        AMP.setState({wishstatus: event.response.codez})">
     **PHP LOOP**
         for ($x = 0; $x <= 5;$x++) {
          <a href="..." [class]="wishstatus" on="tap:AMP.setState({datataptype: '1', 
          datatappost:'123'}),courseTap.submit">
          </a>
          }
           <input type="text" name="wtm"  [value]="datataptype" hidden>
           <input type="text" name="wcy"  [value]="datatappost" hidden>
                        <div submit-success>
                            <template type="amp-mustache">
                              {{message}} 
                           </template>
                        </div>
                        <div submit-error>
                           <template type="amp-mustache">
                             {{message}} 
                           </template>
                        </div>   
                 </form>     

                 
4

0 回答 0