通过URL传递价值价值、URL

2023-09-10 14:34:05 作者:冰是睡着的水

component.php

component.php

<script>
   jq142(document).ready( function() {
       new Paginator('<?php echo HOST_URL; ?>component_ajax.php');
});        
</script>

我需要通过ID从component.php文件component_ajax.php文件。 component_ajax.php将加载在component.php文件。

I need to pass the id from component.php file to component_ajax.php file. component_ajax.php will load on the component.php file.

component_ajax.php

component_ajax.php

$coid = $_GET['id'];
$products = $productObj->getFrontProductsbyComponents( $coid );

解释我是如何通过id来 $ COID

推荐答案

您需要追加的ID给component_ajax.php URL。

You need to append the id to the component_ajax.php URL.

new Paginator('<?php echo HOST_URL; ?>component_ajax.php?id=<?php echo $your_id; ?>');

如果你需要传递给component_ajax.php ID是在JavaScript中,而不是PHP,附加ID,以支持JavaScript的URL。

If the ID you need to pass to component_ajax.php is in JavaScript instead of PHP, append the ID to the URL with javascript.

<script>
    var your_id = 123;
    jq142(document).ready( function() {
        new Paginator('<?php echo HOST_URL; ?>component_ajax.php?id=' + your_id);
    });
</script>
 
精彩推荐
图片推荐