How put a variable in a link

后端 未结 3 936
有刺的猬
有刺的猬 2021-01-29 16:44

i have this link and this variable:

var fin = \"SAT000000002574\";
\"http://sat3.altervista.org/index.php?id=\'+fin\'\"

I don\'t know how i hav

相关标签:
3条回答
  • 2021-01-29 17:20

    youre mixing double quotes with single quotes

     "http://sat3.altervista.org/index.php?id="+fin
    
    0 讨论(0)
  • 2021-01-29 17:30

    You can just simply using a + to concatenate the fin variable here:

    var fin = "SAT000000002574";
    "http://sat3.altervista.org/index.php?id="+fin
    
    0 讨论(0)
  • 2021-01-29 17:32

    Interpolation is not standard in javascript. Maybe this can help you http://www.diveintojavascript.com/projects/javascript-sprintf

    Contatination is your best option, but the methods below can also help.

    String.concat();
    
    ["foo", "bar"].join("");
    
    0 讨论(0)
提交回复
热议问题