我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在HTML页面上使用Golang进行实时搜索

I'd like to run a search and display its results as soon as the text of an <input> changes.

How could the program get the value from the <input> when it changes?

<input type="text" name="search" id="search">
<section id="results"></section>

Post you value to Golang with ajax.

$("input").keyup(function(){
txt=$("input").val();
$.post("url",{suggest:txt},function(result){
     $("#results").html(result);
     });
   });

近期文章

  • 在导入的结构上覆盖结构字段标签
  • 如何在Go中合并类似的多包项目
  • 在方法或构造函数级别没有处理?
  • Intellij如何设置默认调试端口
  • 超时长时间运行的cgo函数调用
  • 如何通过go例程连接多个切片
  • 如何在不共享bufio.Scanner的情况下反复从os.Stdin中读取
  • 为什么不填充此HTTP请求的“响应”字段?
  • 用于遍历地图的Golang不会返回不一致的值[重复]
  • 处理模型特定操作与数据库操作
  • Node.js / Golang AES 256解密
  • Golang AWS Xray.sql错误
  • GCC在构建时未定义的引用
  • CPU /未在core.v1.Pod.PodSpec中填充的内存量
  • 如何使用gonum / go制作具有复杂数字条目的矩阵?
  • 使用代理时去泄漏goroutines
  • 通过JSON-RPC调用传递身份验证详细信息
  • 通道并发保证
  • sync.Map是原子的吗? 我主要是指加载,存储,加载或存储,删除
  • 通过名称设置protobuf属性

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华