将javascript变量转换为php函数 [英] javascript variable to php function

查看:62
本文介绍了将javascript变量转换为php函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一小段代码

Hi all i have a small bit of code

<script>
function fun(var1_name)//var1_name is the name of the button which is clicked from html table
{
var s="t"+var1_name;
var x=document.getElementById(s).value;

}
</script>




我需要的是我必须将x变量传递给具有某些逻辑的PHP函数.如何将x传递给php函数?请帮助




What i need is i have to pass the x variable to a PHP function which have some logic. How to pass x to the php fuction?. Pls help

推荐答案

无法将客户端脚本变量的值直接传递到服务器端变量/函数,因为这两个脚本都在不同的平台(即客户端)上执行浏览器和Web服务器.唯一的方法是使用AJAX来做到这一点.因此,我建议您阅读AJAX教程

问候
帕旺
There is no way to directly pass the values of client script variable to server side variables/functions, Since both these scripts execute on different platforms i.e., client browser and web server respectively. The only way is to use AJAX to do it. So I''d recommend you to read AJAX tutorials

Regards
Pawan


这篇关于将javascript变量转换为php函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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