javascript - 通过 url 传递值但页面无法重定向

标签 javascript php ajax url sms

我正在使用短信网关。我想通过url发送如下格式的数据

http://127.0.0.1:13013/cgi-bin/sendsms?username=uname&password=password&to=+911111111111&text=Hello

我想调用这个网址,但当前页面无法更改,因为该页面同时运行另一个功能。我正在使用 header 功能,它发送了短信,但当前页面功能无法工作。所以有人建议我一个解决方案

最佳答案

您可以使用 jQuery post:

$.post( "http://127.0.0.1:13013/cgi-bin/sendsms", { username: "uname", password: "password", password: "+911111111111", text: "Hello"  } );

它是一个简写的Ajax函数,不会改变您当前的页面。 您也可以使用回调函数来检查请求状态。

参见:http://api.jquery.com/jQuery.post/

关于javascript - 通过 url 传递值但页面无法重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19587466/

相关文章:

javascript - 当前日期两次之间的时间间隔

php - 是否有等效于 php 的 urldecode 或 html_entity_decode() 的 javascript?

php 使用 system()/shell_exec()/exec() 运行终端应用程序,但只显示一半的输出

javascript - 如何使用 Ajax 发送和接收隐藏值

javascript - 使用ajax将地理定位添加到数据库

php - 如何使用 Typescript 发出 AJAX 请求? (使用 JSON)

javascript - Googlebot 什么时候执行 javascript?

javascript - 无法摆脱 ForbiddenError : invalid csrf token on express with csurf

javascript - 使用 SVG 的线性双色平滑和锐利渐变

php - 服务器端linkedIn API身份验证