简体   繁体   English

如何从另一个应用程序打开一个应用程序,然后打开引导程序模式?

[英]How can I open an application from another application and then open a bootstrap modal?

We have two browser applications. 我们有两个浏览器应用程序。 One application (app1) wants to open another application (app2), send data in its URL, open a bootstrap modal in app2, and fill out the fields with the data sent from app1. 一个应用程序(app1)想要打开另一个应用程序(app2),在其URL中发送数据,在app2中打开引导程序模式,并使用从app1发送的数据填写字段。 Is this possible? 这可能吗?

I'm pretty sure it is possible to send data from app1 to app2 through an URL, but the opening of the popup modal is what I don't understand how to do. 我很确定可以通过URL将数据从app1发送到app2,但是我不知道如何打开弹出模式。 Once the data is sent via URL, we need to click on the link that opens the popup modal and have the fields filled in. But how would we trigger the opening of the modal popup after the url data transfer ? 通过URL发送数据后,我们需要单击打开弹出窗口模式的链接并填写字段。但是,如何在url数据传输后触发模式弹出窗口的打开?

here is our modal. 这是我们的模态。

var $modal      = ich.auth({
                            title   : "Authorize",
                            base    : getCategory(type),
                            buttons : [{ id : 'submit',   label : 'Submit', classes : 'btn-primary' },
                                       { id : 'cancel', label : 'Cancel' }]
                            })

I'm attaching a picture for clarification. 我附上一张图片以供澄清。 在此处输入图片说明

If you want to simulate a physical click you will probably want to use the jquery trigger function. 如果要模拟物理点击,则可能要使用jquery触发功能。

Here is the example from the jquery documentation: 这是jquery文档中的示例:

$( "#foo" ).on( "click", function() {
  alert( $( this ).text() );
});
$( "#foo" ).trigger( "click" );

Here is the link to the actual documentation for further reading: https://api.jquery.com/trigger/ 这是实际文档的链接,供您进一步阅读: https : //api.jquery.com/trigger/

The general idea is that trigger() will trigger any events bound to that object, so if you wire it up to be clickable using on() (documentation here ) then calling trigger() will fire the click event just as if it had been clicked. 一般的想法是,trigger()将触发绑定到该对象的任何事件,因此,如果使用on()将其连接为可单击的对象( 此处的文档),则调用trigger()将触发click事件,就像它已经点击。

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

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