doubingjiu3199 2017-09-13 22:47
浏览 25

无需离开原始页面即可发送数据

The watchlistinsert.php sends some information to my database and i want it to send without leaving the original page where i clicked from. I think i need to use some ajax, I have tried a few different things, but it is not working. Hope someone can help me out.

 echo "<td>"."<a id='add' href=\"watchlistinsert.php?symbol=$symbol&price=$price&watchlistgroupid=$watchlistgroupid\">Add</a>"  ."</td>";
  • 写回答

3条回答 默认 最新

  • donglang9880 2017-09-13 22:52
    关注

    You can do this easily with jQuery by using the ajax() function: http://api.jquery.com/jquery.ajax/

    Example:

    $.ajax({
      url: "/path/to/my/file.php",
      data: {
        'key1': 'value1',
        'key2': 'value2'
      },
      success: function(data, textStatus, jqXHR) {
        // do something
      },
      error: function(jqXHR, textStatus, errorThrown) {
        // do something
      }
    })
    

    Read about all the parameters you can use at the above link.

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条