ajax request otp
This commit is contained in:
parent
7041dfe511
commit
850d0cb5f9
1 changed files with 41 additions and 26 deletions
|
|
@ -22,6 +22,8 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ form.phone_number.label_tag }}</td>
|
<td>{{ form.phone_number.label_tag }}</td>
|
||||||
<td>{{ form.phone_number }}</td>
|
<td>{{ form.phone_number }}</td>
|
||||||
|
<td id="request-otp"><a class="btn btn-default">requet otp</a></td>
|
||||||
|
<td id="otp-result"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -34,5 +36,18 @@
|
||||||
<input type="hidden" name="next" value="{{ next }}"/>
|
<input type="hidden" name="next" value="{{ next }}"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$("#request-otp").click(
|
||||||
|
function () {
|
||||||
|
var phoneNumber = $('#id_phone_number')[0].value;
|
||||||
|
|
||||||
|
$.post("/request_otp/",{'phone_number': phoneNumber},function (result) {
|
||||||
|
console.log(result);
|
||||||
|
$("#otp-result")[0].innerHTML = 'otp expire: ' + result['otp_expire'] ;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Add table
Reference in a new issue