[英]How to pass an id value through an anchor tag to a modal popup
How can I pass an id value through an anchor tag to a modal popup and display the id value on a field in the modal.如何通过锚标记将 id 值传递给模式弹出窗口并在模式中的字段上显示 id 值。
It depends on how your modal popup works.这取决于您的模态弹出窗口的工作方式。 Since you have not given any information about this, I will describe a few cases:
由于您没有提供任何相关信息,我将描述几个案例:
If your modal does not need any information from the server and is opened by Javascript only, then you will only need to check the functionality it uses, see how options are passed to that modal and how that functionality is being called.如果您的模态不需要来自服务器的任何信息并且仅由 Javascript 打开,那么您只需检查它使用的功能,查看选项如何传递给该模态以及如何调用该功能。 There should be some parameters that you can pass, or options.
应该有一些您可以传递的参数或选项。 You can check this and see whether there is already support to do this.
你可以检查一下,看看是否已经有支持这样做。 If so, then use your id value and pass it to your modal.
如果是这样,则使用您的 id 值并将其传递给您的模态。 If not, then you will need to customize your modal, or use some extension which customizes it in your stead.
如果没有,那么您将需要自定义您的模态,或者使用一些扩展来代替您自定义它。
Assuming that you are sending a POST request via AJAX to the server, in the callback of that request you can simply and effectively tell your modal what the id is.假设您通过 AJAX 向服务器发送 POST 请求,在该请求的回调中,您可以简单有效地告诉您的模态 ID 是什么。 If the id is already known by the client-side, then it's just like in the previous section.
如果客户端已经知道 id,那么就像在上一节中一样。 If only the server is aware of the id value, then it could send it back to the client-side as part of the response and from there on you can operate as in the case of client-side only modal handling.
如果只有服务器知道 id 值,那么它可以将其作为响应的一部分发送回客户端,然后您就可以像在客户端仅模态处理的情况下一样操作。
If you are showing an iframe in the modal, then you can pass a parameter to that iframe via a src如果您在模态中显示 iframe,那么您可以通过 src 将参数传递给该 iframe
In all cases, if the modal is aware of the id, you can use its value in your anchor tag.在所有情况下,如果模态框知道 id,您可以在锚标记中使用它的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.