以前我有一些这样的代码来向用户发送消息
<button class="notif btn btn-success"
href="https://api.telegram.org/bot{{ config('app.token') }}/sendMessage?chat_id={{ $rp->report_idsender }}&text=Halo%20{{ $rp->sender_name }}%20permintaan%20anda%20dengan%20id%20{{ $rp->id }}%20sudah%20di%20close%20">Notif</button>
我正在使用 jquery 和 js 从 href 获取 URL 并执行 HTTPS 发布请求,它对我来说非常适合
<script type="text/javascript">
$(".notif").unbind().click(function() {
var url = $(this).attr("href");
console.log(url);
var exe = $.post(url,function() {
alert('Success');
})
});
</script>
但现在我想用回复 id 向 Telegram 上的一个群组发送照片,代码如下所示:
<form method="POST"
action="https://api.telegram.org/bot{{ config('app.token') }}/sendPhoto" enctype="multipart/form-data">
<input type="text" name="chat_id" value="{{ config('app.idgroup') }}" hidden />
<input type="text" name="reply_to_message_id" value="{{ $rp->msg_id }}" hidden />
<input type="text" name="allow_sending_without_reply" value="true" hidden />
<br />
<label for="caption"> Caption</label>
<input type="text" name="caption" placeholder="caption" />
<br />
<input type="file" name="photo" />
<br />
<input type="submit" value="sendPhoto" />
</form>
这段代码的问题在于,在我提交表单后,它打开了一个包含 JSON 响应的页面,而我只想像在之前的代码中那样提醒它。
问题是,如何使用 js/jquery 在 URL 中使用回复 id 发送带有电报机器人表单的照片??