【问题标题】:how to retrieve a value from a thickbox jquery to the PHP file which called the thickbox?如何从thickbox jquery 中检索一个值到调用thickbox 的PHP 文件中?
【发布时间】:2012-07-04 08:12:14
【问题描述】:

如何从一个thickbox jquery 中检索一个值到调用thickbox 的PHP 文件中?..这个thickbox 给出了提示。所以我需要根据 jquery 函数内部是否发生某些事情来更新数据库。那我该怎么办呢?

【问题讨论】:

    标签: php jquery dynamic thickbox


    【解决方案1】:

    当您的 jQuery 触发您的 PHP 脚本时,您的 PHP 脚本已经完成,但您可以再次调用它或使用 ajax 将一个单独的 php 文件一起调用:

    $.ajax({
      type: "GET",
      url: "some.php",
      data: { name: "John", location: "Boston" }
    })
    

    在 some.php 里面:

    <?php
    
    $this_is_the_name = $_GET['name'];
    $this_is_the_loc = $_GET['location'];
    
    //add these to database or whatever
    
    ?>
    

    您可能希望采取一些保护措施来阻止 SQL 注入攻击 - 任何人都可以将任何数据推送到他们喜欢的脚本中。

    【讨论】:

    • 但我不想关闭厚盒。我需要提示已使用的值或指示。此指示将是通过 jquery 传递给 PHP 的变量。如何实现从 jquery 到 PHP 的变量传递?
    • ajax函数只会在后台调用php文件——浏览器窗口不会改变。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多