简体   繁体   English

通过javascript向手机发送消息

[英]Send message to mobile through javascript

I am new in javascript i want to send a message to mobile using javascript In PHP this can be done by this code 我是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');

But i am using the opencart and i want to perform this action using the javascript 但是我正在使用opencart,我想使用javascript执行此操作

In javascript i am using the window.location to open the url in in window but i don't want to open in window 在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');

Please help to solve this problem 请帮忙解决这个问题

Try using AJAX. 尝试使用AJAX。

Read more here: http://www.w3schools.com/ajax/ajax_examples.asp 在此处阅读更多信息: http : //www.w3schools.com/ajax/ajax_examples.asp

AJAX 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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM