发送一个url,但保持在同一页面(php,codeigniter,javascript) [英] sending an url but staying on the same page ( php, codeigniter, javascript )

查看:119
本文介绍了发送一个url,但保持在同一页面(php,codeigniter,javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况。我在codeigniter中写一个webinterface,以发送命令到虚拟服务器。这些命令通过浏览器在url中传递。

this is my situation. I'm writing an webinterface in codeigniter to send commands to a virtual server. these commands are passed through the browser in an url.

示例: http: //server.com/TgtSendIRCommand?id=UM-02&code=KEY_UP
此服务器随后采取操作,Web界面刷新屏幕截图。

example : http://server.com/TgtSendIRCommand?id=UM-02&code=KEY_UP this server then takes action and the web interface refreshes the screenshot.

我只是希望有一堆html的链接发送这个命令到浏览器。
但是如果我点击链接,用户必须保持在同一页。所以命令被发送,但没有其他交互。

i just want to have a bunch of links in html that send this command to the browser. But if i click the links, the user has to stay on the same page. So the command is sended but there is no other interaction.

我使用codeigniter。

i am using codeigniter.

有任何建议吗?

推荐答案

查看并复制此视图:

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
</head>
<body>
<a href="#" id="myBtn">Click here!</a>

<script type="text/javascript">
  $(document).ready(function(){
     $("#myBtn").click(function(){  
       $.get("http://server.com/TgtSendIRCommand?id=UM-02&code=KEY_UP ");        
     });
  });
</script>
</body>
</html>

未测试,但上述内容应该为您解决问题。

Not tested but something as above should do the trick for you.

这篇关于发送一个url,但保持在同一页面(php,codeigniter,javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆