我有一個PHP表單,它使得點擊sumbit按鈕的ajax調用來保存數據庫中的數據。我想調用短信API來發送這些細節點擊相同的提交按鈕。我怎麼做?我正在使用http://sms.hspsms.com/。使用短信發送API點擊按鈕
這裏是腳本這需要數據annd其保存到數據庫:
<script>
$(function() {
$('#user-form').on('submit', function(e) {
$.ajax({
type: 'post',
url: './user-details.php',
data: $('#user-form').serialize(),
success: function() {
alert('SUCCESS');
}
});
e.preventDefault();
});
});
</script>
在哪裏使用SMS API,如:
http://sms.hspsms.com:/sendSMS?username=swati&message=XXXXXXXXXX&sendername=XYZ&smstype=TRANS&numbers= & apikey = XXXXXX
發送詳情進入在形式中。
編輯:我找到了解決辦法,它發佈爲答案。
請提供您的一些測試代碼是行不通的。 – vitorio