获取keydown值拼接url地址传值

  1. var url = `http://47.108.197.28:3000/search?keywords=`
  2. $("#app").keydown(function(event){
  3. if(event.keyCode==13){
  4. var value = $(this).val();
  5. if(value.trim()){
  6. var httpUrl = url+value;
  7. /* 已经获取到数据 */
  8. console.log(httpUrl)
  9. $("#container").html(httpUrl)
  10. }
  11. }
  12. })