我可以在不使用AJAX的情况下在Javascript中运行PHP代码吗?

问题描述:

如何在JavaScript函数中不使用AJAX将JavaScript变量转换为php变量。

How to convert JavaScript variable to php variable without using of AJAX inside the JavaScript function.

 function getProduct(category)
{
    document.galaxy.action = '<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=11') ?>';
    document.getElementById('galaxy').submit();
}

我需要将js变量category转换为php变量。

I need to convert js variable "category" to php variable.

这是可能。

Javascipt 是一种客户端语言,这意味着它将在访问者的计算机上运行。

Javascipt is an client-side language, this means that its going to run on the computer of your visitor.

PHP 是一种服务器端语言,这意味着它将在您的服务器上运行。

PHP is an server-side language, this means that is going to run on your server.