我正在尝试使用MvcHtmlString.Create创建一个JavaScript变量。但是,输出仍在编码中。
var geocode_jsonresult = @MvcHtmlString.Create(Url.Action("GeoLocation", "Generic", New With {.address = "$(this).val()"}));创建以下输出
var geocode_jsonresult = /generic/GeoLocation?address=%24(this).val();当它真正“应该”的时候
var geocode_jsonresult = /generic/GeoLocation?address=$(this).val();我如何防止这种情况发生?
备注
我使用的是VB而不是C#
发布于 2010-11-24 16:16:37
你的javascript似乎坏了。它不应该是:
var geocode_jsonresult =
'@Url.Action("GeoLocation", "Generic")?address=' +
encodeUriComponent($(this).val());是否正在尝试将服务器端的url helper与客户端的值混合?
发布于 2010-11-24 16:23:33
试一试
var geocode_jsonresult =
'@Url.Action("GeoLocation", "Generic")?address=' + $(this).val();https://stackoverflow.com/questions/4264640
复制相似问题