通过URL传递价值 [英] Passing values through URL

查看:175
本文介绍了通过URL传递价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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>

这篇关于通过URL传递价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆