开发者

How to send a URL request to a server without expecting a response back in Javascript

开发者 https://www.devze.com 2023-01-26 19:19 出处:网络
I am using a VoIP softswitch. In order to trigger a call I have to send the call parameters (user/pass/phone#) via http to a URL without be开发者_如何学JAVAing redirected to that URL.

I am using a VoIP softswitch. In order to trigger a call I have to send the call parameters (user/pass/phone#) via http to a URL without be开发者_如何学JAVAing redirected to that URL. I tried JavaScript FORM with GET but I had no success.


The request is not really relevant, the response is:

When the server responds with a 204 No Content (instead of the usual 200 OK), the browser stays on the original page. See e.g. this.


You should use an asynchronous request (AJAX).

This is substantially easier if you use a framework that provides the facility, for instance jQuery. Or you can do it directly, find a good tutorial (example).

0

精彩评论

暂无评论...
验证码 换一张
取 消