简体   繁体   English

jQuery EasyUI选项卡Ajax

[英]jQuery EasyUI tabs Ajax

I created some tabs using jQuery EasyUI tabs . 我使用jQuery EasyUI选项卡创建了一些选项 The content of the tab is loaded by Ajax because I pass the href attribute to my tab like: 该选项卡的内容由Ajax加载,因为我将href属性传递给了我的选项卡,如下所示:

<div id="mytabs" class="easyui-tabs" style="width:500px;height:250px;">  
    <div title="Tab1" href="/app/controller/tab_content" style="padding:20px;">  
        tab1  
    </div>  
    <div title="Tab2" href="/app/controller/tab_content" style="padding:20px;">  
        tab2  
    </div>  
    <div title="Tab3" href="/app/controller/tab_content" style="padding:20px;">  
        tab3  
    </div>  
</div>

As you can see above, every time a tab is selected, the action tab_content which contains the content to be displayed in the tab panel (/app/controller/tab_content is just for illustration) is called. 如上所示,每次选择选项卡时,都会tab_content操作tab_content ,其中包含要在选项卡面板中显示的内容(/ app / controller / tab_content仅用于说明)。 All of this work fine, but what I'm trying to do is to make a variable available to the view tab_content.ctp when the url is called (WITHOUT passing it as a parameter in the url) like: 所有这些工作都很好,但是我想做的是在调用url时使变量对视图tab_content.ctp可用(但没有将其作为url中的参数传递):

/app/controller/tab_content/my_variable:test

Is there any way that I can pass a variable to my view when the tab is clicked without passing it to the url of the tab content? 单击选项卡时,是否有任何方法可以将变量传递到视图中而不传递给选项卡内容的url? In order words, I want my_variable to be available to the view tab_content.ctp when the tab is clicked. 用顺序的话来说,我希望my_variable在单击选项卡时可用于视图tab_content.ctp

Note: This is a cakephp application 注意:这是一个cakephp应用程序

Thank you 谢谢

You might have solved the problem already, but I ran into a similar issue with EasyUI tabs and remote content and thought I might share it. 您可能已经解决了该问题,但是我遇到了EasyUI选项卡和远程内容的类似问题,并认为我可以共享它。 What I ended up doing was 我最终要做的是

  • for the variable to be passed: declare it as a window.variable , ie by setting window.my_variable = my_variable 对于要传递的变量:将其声明为window.variable ,即通过设置window.my_variable = my_variable
  • for the external tab content: call the variable via javascript in the external file - since a window.variable has global scope, it is also available in dynamically loaded content (see this answer) 为外部标签内容:通过JavaScript调用该变量的外部文件-因为window.variable具有全球范围的,它也是动态加载的内容提供(见这个答案)

Hope this is of help. 希望这会有所帮助。

Edit jquery.easyui.min.js and search for: 编辑jquery.easyui.min.js并搜索:

$.fn.panel.defaults

Change method: "get" to method "post" 将方法:“获取”更改为方法“发布”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM