我可以在不使用AJAX的情况下在Javascript中运行PHP代码吗? [英] Can I run PHP code in Javascript without using AJAX?

查看:92
本文介绍了我可以在不使用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.

这篇关于我可以在不使用AJAX的情况下在Javascript中运行PHP代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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