Home  >  Article  >  Backend Development  >  JS参数传递,该如何解决

JS参数传递,该如何解决

WBOY
WBOYOriginal
2016-06-13 10:12:201161browse

JS参数传递
现用Smarty做网站,想把在html页面中JS计算出来的变量fee提交到一个php处理页面去,用语句
document.frm.action="?do=info&action=submit&id=&fee=fee";
在php中获取:$fee=empty($_GET['fee'])?'':trim($_GET['fee']);
不过就是传递不过来,请问各位大虾正解如何?(JS中代码如下)


------解决方案--------------------
确实对新手来讲由于缺少必要的条理逻辑,所以只能用简单的传值方式来实现页面间值得传递,由于我也是新手了所以也只能说说我的困惑,我用js获取本页的文本结点然后通过异步请求将值传递到后台页面,然后打开后台php页面发现传递过来的值不可以直接运用,就是本身后台页面就是用来显示的,显示的东西和传递过来的值密切相关。怎么才能将上个页面传递过来的值直接用于显示呢?
------解决方案--------------------
你的代码还是用代码格式贴出来吧,这样看的很不舒服捏!
------解决方案--------------------
你最好打开编译后的文件,看看
document.frm.action="?do=info&action=submit&id=&fee=fee";
变成了什么
------解决方案--------------------
document.frm.action="?do=info&action=submit&id=&fee="+fee;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn