同一页面上有多个电子邮件地址的 SimpleModal 联系表

发布于 2024-10-08 06:20:31 字数 1328 浏览 0 评论 0原文

我有一个包含 5 个不同电子邮件地址的联系页面,例如 [电子邮件受保护][电子邮件受保护][email protected] 等...理想情况下,我希望每个链接都打开专门定制的不同版本的 contact.php对于该地址。我确信必须有一种方法将变量(contact_info.php 或 contact_feedback.php)从链接传输到 contact.js 以加载适当的 php 文件。任何帮助都会很棒。

非常感谢埃里克。我最终

<a href='#' id="info" class='contact'>[email protected]</a>
<a href='#' id="jobs" class='contact'>[email protected]</a> 

在 contact.js 中执行了以下操作,我将链接更改为以下内容:

// load the appropriate contact form using ajax
$.get("data/contact_"+this.id+".php" , function(data){

然后我相应地保存了每个 contact_*php 实时

页面可以在此处找到 http://www.nashi.com.au/contact.html

I have a contact page with 5 different email addresses e.g. [email protected], [email protected], [email protected] etc... Ideally I would like each link to open a different version of contact.php that is customized specifically for that address. I'm sure there must be a way to transfer a variable (contact_info.php or contact_feedback.php) from the link to the contact.js to load the appropriate php file. Any help would be awesome.

Many thanks for that Eric. I ended up doing the following

<a href='#' id="info" class='contact'>[email protected]</a>
<a href='#' id="jobs" class='contact'>[email protected]</a> 

in the contact.js I changed the link to the following:

// load the appropriate contact form using ajax
$.get("data/contact_"+this.id+".php" , function(data){

I then saved each contact_*php accordingly

Live page can be found here http://www.nashi.com.au/contact.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美胚控场 2024-10-15 06:20:31

由于您没有指定,我假设您正在使用联系表单演示。

一个建议:

1)为每个联系人链接分配一个 id:

<a href="#" id="info" class="smcf-link">More Info</a>
<a href="#" id="jobs" class="smcf-link">Jobs</a>

2)修改 contact.js 文件以将 ID 传递给 contact.php 文件:

$('#contact-form input.contact, #contact-form a.contact').click(function (e) {
    e.preventDefault();

    // load the contact form using ajax
    $.get("data/contact.php?id=" + this.id, function(data){
        // create a modal dialog with the data
        ...
    });
});

3)修改 contact.php< /code> 文件来接收 id 并进行相应处理:

$token = isset($_POST["token"]) ? $_POST["token"] : "";
$id = isset($_GET["id"]) ? $_GET["id"] : "";

// do whatever you need to do based on the value in $id

您可以创建不同的 php 文件(并相应地更改 JS),这取决于您。

-埃里克

Since you didn't specify, I'm assuming you are using the Contact Form Demo.

One suggestion:

1) assign an id for each contact link:

<a href="#" id="info" class="smcf-link">More Info</a>
<a href="#" id="jobs" class="smcf-link">Jobs</a>

2) Modify the contact.js file to pass the ID to the contact.php file:

$('#contact-form input.contact, #contact-form a.contact').click(function (e) {
    e.preventDefault();

    // load the contact form using ajax
    $.get("data/contact.php?id=" + this.id, function(data){
        // create a modal dialog with the data
        ...
    });
});

3) Modify the contact.php file to receive the id and processing accordingly:

$token = isset($_POST["token"]) ? $_POST["token"] : "";
$id = isset($_GET["id"]) ? $_GET["id"] : "";

// do whatever you need to do based on the value in $id

You could create different php files (and change the JS accordingly), it's up to you.

-Eric

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文