Reputation: 11
on submit-success, form returns a JSON response and I am trying to add the response to the clicked tag [class]="wishstatus" but it is getting added to all the tag since it is in the PHP loop.
is there any solution to add the JSON response to the clicked tag..?
JSON Response {"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>
Upvotes: 1
Views: 192