dongzong8110 2013-02-13 11:34
浏览 46
已采纳

从链接运行PHP代码而不重定向

I want to execute a php code when a user click on a given link , i've tried the following code

<!DOCTYPE html>
<html>
<head>

 <script type="text/javascript" src="jquery.min.js"></script>
 <script type="text/javascript">
 function doSomething() {
 $.get("up.php");
 return false;
 }
</script>


  </head>

  <body>

  <center>
  <a href="#" onclick="doSomething();">Click Me!</a>


   </center>

   </body>
  </html>

where up.php is a php code that implement android GCM mechanism similer to the one in the link : GCM with PHP (Google Cloud Messaging)

but unfortunately when the link is clicked nothing happens , the php code not executed ,and only the url of the page change form *****.com/test.html to *****.com/test.html# , and by the way I've tested the php code and its works fine so it is not a problem in php code , so what i have missed here? why the code is not executed?

  • 写回答

6条回答 默认 最新

  • douguanya4248 2013-02-13 16:15
    关注

    i found the solution , the problem that the jquery library is not included probably in my code

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)