使用动态 href 加载 jquery 选项卡
我不确定这个问题是否已经得到解答,但是
我有 4 个选项卡,其中两个是通过控制器调用加载的;其余的我想改变 href
并自动/按需加载。
我的问题是,即使分配像“www.google.com”这样的固定 href
也无法完成显示远程页面的工作;并且带有变量 href
的两个选项卡已正确更改为正确的值,如下所示 -
$("#anchor_ID").attr("href", "myURL"+var1)
但是,这些选项卡不会按预期加载内容。
有什么需要检查的地方,这里可能发生了什么?您还希望我提供多少信息?
非常感谢
I'm not sure if this has already been answered, but here goes
I have 4 tabs, two of which I load through controller calls; the remainder I'd like to vary the href
s of and load automatically/on demand.
My problem is that even assigning a fixed href
like "www.google.com" is not doing the job of displaying the remote page; and the two tabs with the variable href
's are properly being changed to the correct value, like so -
$("#anchor_ID").attr("href", "myURL"+var1)
where anchor_ID
is the <a href="..." id="anchor_ID" ....></a>
but, these tabs don't load the content as expected.
Any points to check, what could be going on here? How much more info would you like for me to provide?
Thanks a bunch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜 jQuery UI 选项卡不支持通过简单的不显眼的 ajax 样式加载远程内容(在不同域上的远程 == 的意义上)。您需要使用 iframe 作为选项卡的内容。
如果您检查“本地远程文件”选项卡,您会注意到该 url 指向“本地”服务器上的文件。如果这对您不起作用,您应该将示例发布到
"myURL"+var1
真正评估的内容。查看此演示页面
http://jsbin.com/uqile
I guess jQuery UI Tabs doesn't support loading remote content (in the sense of remote == on different domain) via the simple unobtrusive ajax-style. You need to use an iframe as content of the tab for that.
If you check the tab "Local remote file" you notice that the url points to a file on "local" server. If that doesn't work for you you should post a sample to what
"myURL"+var1
really evaluates too.Check this demo page
http://jsbin.com/uqile