Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

javascript - 我的语法有误,请告知JavaScript和JQuery的适当语法?(Error on my syntax, please advise on the appropriate syntax for JavaScript & JQuery?)

I'm very new to JavaScript as well as jQuery, on my visual studio code its saying expression expected near var se and also it says '}' expected near {"URL":window.location.href,} what will be the appropriate fix for this.(我对JavaScript和jQuery都是陌生的,在我的Visual Studio代码中,它的说法表示在var se附近,并且它说'}'{"URL":window.location.href,}附近{"URL":window.location.href,}什么{"URL":window.location.href,}合适的为此解决。)

Please advise.(请指教。) Here's my code:(这是我的代码:) <script type = "text/javascript"> function renderSurvey(URL){ var se = new SurveyEmbed("FM9wg_ghhgvjh","https://formsss.tester.com/","https://jhbjh.kjbkjedge.net/mfpembedconkhtweu/"); var context = {"URL":window.location.href,};se.renderButton( context); } </script>   ask by Waqar Malik translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is nothing actually wrong with your code, my Visual Studio Code also doesn't give any errors.(您的代码实际上没有错,我的Visual Studio代码也没有给出任何错误。)

You can improve on readability though, I think something like this is way cleaner (other people might disagree):(不过,您可以提高可读性,我认为类似这样的方法会更干净(其他人可能会不同意):) function renderSurvey(URL) { let se = new SurveyEmbed( "FM9wg_ghhgvjh", "https://formsss.tester.com/", "https://jhbjh.kjbkjedge.net/mfpembedconkhtweu/" ); let context = { URL: window.location.href }; se.renderButton(context); }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...