ASP.NET ScriptManager CompositeScript 不适用于需要查询字符串参数的 javascript
我的 .js 文件中有一个 jQuery 函数,该函数需要传递一个查询字符串参数。
如果我尝试在 ScriptManager 中使用 CompositeScript 功能,它会在具有查询字符串的文件上呕吐。有什么办法解决这个问题吗?
I have a jQuery function in a .js file, and the function requires a querystring parameter to be passed.
If I try to use the CompositeScript feature in the ScriptManager, it pukes on the file that has the querystring. Is there any way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我试图做同样的事情,但得到的错误类似于“URL 不是虚拟路径”,所以我假设路径必须是虚拟的。因此您可能无法执行此操作,因为将查询字符串变量附加到路径将导致 URI 阻塞。
如果是全局变量,您可以在页面或母版页中设置变量,因此不需要传递查询字符串。
可能是完成您正在完成的任务的一种方法,但我的猜测是您必须添加另一个步骤,例如 jsfile.js?qv=whatever 到 jsfile.js 的路由,或者添加 httphandler。可能麻烦多于其价值。
只是猜测。
I was trying to do the same thing and the error I got was something like "URL was not a virtual path" so I'm assuming the path must be virtual. So you may not be able to do this as appending the querystring variable to the path will cause the URI to choke.
You could set your variable in the page or masterpage if global, thus you wouldn't need to pass a querystring.
Might be a way to do what you are accomplishing, but my guess would be that you would have to add in another step, like a route to the jsfile.js?qv=whatever to jsfile.js, or add in an httphandler. Probably more trouble than it is worth.
Just guesses.