有没有办法在src中放置参数? [英] Is there a way to put parameters in src?
本文介绍了有没有办法在src中放置参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
decimal MyLat = ViewBag.MyLat;
decimal MyLong = ViewBag.MyLong;
<script src="https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=@MyLat,@MyLat&radius=500&types=food&name=cruise&key=MyKey"></script>
显示以下错误消息:
Uncaught SyntaxError:Unexpected token
我尝试保留Google Maps的数据动态改变搜索(名称,类别,城市,评级等)
有什么能帮助我吗?
谢谢!
Showing me the following error:
"Uncaught SyntaxError: Unexpected token"
I try to keep data from Google Maps According to dynamically changing search (name, category, city, rating, etc.)
Something that can help me?
Thank you!
推荐答案
查看jquery getScript:
https://api.jquery。 com / jquery.getscript / [ ^ ]
或者看看这个:
http://www.javascriptkit.com/javatutors/loa djavascriptcss.shtml [ ^ ]
祝你好运!
Check out jquery getScript:
https://api.jquery.com/jquery.getscript/[^]
Or check out this:
http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml[^]
Good luck!
你可以这样做。请检查
You can done this way. Please check
@{
decimal MyLat = 12347;
decimal MyLong = 3494858;
var script = string.Format("<script src='https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={0},{1}&radius=500&types=food&name=cruise&key=MyKey'> </script?", MyLat, MyLong);
}
@Html.Raw(script);
这篇关于有没有办法在src中放置参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文