通过javascript向移动设备发送消息

时间:2016-07-23 10:10:53

标签: javascript php jquery ajax opencart

我是javascript的新手我想用javascript向手机发送消息 在PHP中,这可以通过此代码完成

$number = 'your-number';

$url = "http://pointsms.in/API/sms.php?username=[xxxxxx]&password=[xxxxxx]&from=[xxxxxxxx]&to=[xxxxxxxxxx]&msg=[xxxx]&type=1&dnd_check=0";

fopen($url, 'r');

但我正在使用opencart,我想使用javascript

执行此操作

在javascript中我使用window.location打开窗口中的url 但我不想在窗口打开

window.location.replace('http://pointsms.in/API/sms.php?username=[xxxxxx]&password=[xxxxxx]&from=[xxxxxxxx]&to=[xxxxxxxxxx]&msg=[xxxx]&type=1&dnd_check=0');

请帮助解决这个问题

2 个答案:

答案 0 :(得分:0)

尝试使用AJAX。

在此处阅读更多内容:http://www.w3schools.com/ajax/ajax_examples.asp

答案 1 :(得分:0)

AJAX

var xhr = new XMLHttpRequest()
xhr.open('GET', 'http://pointsms.in/API/sms.php?username=[xxxxxx]&password=[xxxxxx]&from=[xxxxxxxx]&to=[xxxxxxxxxx]&msg=[xxxx]&type=1&dnd_check=0', true)
xhr.send()
相关问题