简体   繁体   English

如何从一个thickbox jQuery检索值到称为thickbox的PHP文件?

[英]how to retrieve a value from a thickbox jquery to the PHP file which called the thickbox?

How to retrieve a value from a thickbox jquery to the PHP file which called the thickbox?..This thickbox is giving hints. 如何从一个thickbox jQuery检索到一个名为thickbox的PHP文件的值?.. thickbox提供了提示。 So i need to update the database on the basis of whether something happens inside the jquery function. 所以我需要根据jquery函数内部是否发生任何事情来更新数据库。 So how do I go about it? 那我该怎么办呢?

By the time your jQuery fires your PHP script has already finished, but you can call it again or a seperate php file all together using ajax: 到您的jQuery触发时,您的PHP脚本已经完成,但是您可以使用Ajax再次调用它或单独的php文件:

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

and inside some.php : 在some.php里面:

<?php

$this_is_the_name = $_GET['name'];
$this_is_the_loc = $_GET['location'];

//add these to database or whatever

?>

You may wish to put some protection in place to stop SQL injection attacks - anyone could push any data into that script they like. 您可能希望采取一些保护措施来阻止SQL注入攻击-任何人都可以将任何数据推送到他们喜欢的脚本中。

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

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