Home Backend Development PHP Tutorial JS参数传递,该如何解决

JS参数传递,该如何解决

Apr 01, 2017 pm 03:59 PM

JS参数传递

现用Smarty做网站,想把在html页面中JS计算出来的变量fee提交到一个php处理页面去,用语句

document.frm.action="?do=info&action=submit&id=<!--{$meminfo1.member_id}-->&fee=fee";
Copy after login
Copy after login

在php中获取:

$fee=empty($_GET[&#39;fee&#39;])?&#39;&#39;:trim($_GET[&#39;fee&#39;]);
Copy after login

不过就是传递不过来,请问各位大虾正解如何?(JS中代码如下)

Copy after login

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

document.frm.action="?do=info&action=submit&id=<!--{$meminfo1.member_id}-->&fee=fee";
Copy after login
Copy after login


变成了什么
------解决方案--------------------

document.frm.action="?do=info&action=submit&id=<!--{$meminfo1.member_id}-->&fee="+fee;
Copy after login

 以上就是 JS参数传递,该如何解决 的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Best practices for optimizing Golang function parameter passing performance Best practices for optimizing Golang function parameter passing performance Apr 13, 2024 am 11:15 AM

In order to optimize Go function parameter passing performance, best practices include: using value types to avoid copying small value types; using pointers to pass large value types (structures); using value types to pass slices; and using interfaces to pass polymorphic types. In practice, when passing large JSON strings, passing the data parameter pointer can significantly improve deserialization performance.

Detailed explanation of C++ function parameters: Performance optimization of parameter passing in parallel programming Detailed explanation of C++ function parameters: Performance optimization of parameter passing in parallel programming Apr 27, 2024 pm 02:09 PM

In a multi-threaded environment, function parameter passing methods are different, and the performance difference is significant: passing by value: copying parameter values, safe, but large objects are expensive. Pass by reference: Passing by reference is efficient, but function modifications will affect the caller. Pass by constant reference: Pass by constant reference, safe, but restricts the function's operation on parameters. Pass by pointer: Passing pointers is flexible, but pointer management is complex, and dangling pointers or memory leaks may occur. In parallel summation, passing by reference is more efficient than passing by value, and passing by pointer is the most flexible, but management is complicated.

Research on parameter passing methods in Go language Research on parameter passing methods in Go language Apr 03, 2024 pm 02:48 PM

In the Go language, there are two main ways to pass function parameters: value passing: passing a copy of the variable will not affect the original variable in the calling code. Pointer passing: Passing the address of a variable allows the function to directly modify the original variable in the calling code.

How to pass parameters to PHP function? How to pass parameters to PHP function? Apr 10, 2024 pm 05:21 PM

PHP functions can pass values ​​through parameters, which are divided into pass by value and pass by reference: pass by value: modification of parameters within the function will not affect the original value; pass by reference: modification of parameters within the function will affect the original value. In addition, arrays can also be passed as parameters for operations such as calculating the sum of data.

What is the parameter passing method for PHP functions? What is the parameter passing method for PHP functions? Apr 10, 2024 am 11:06 AM

There are two ways to pass parameters in PHP: call by value (the parameter is passed as a copy of the value, modification within the function does not affect the original variable) and passing by reference (the address of the parameter is passed, modification within the function will affect the original variable), when the original variable needs to be modified Use reference passing when calculating the shopping cart total price, which requires reference passing to calculate correctly.

Golang formal parameter requirements guide: parameter passing methods, value passing and address passing Golang formal parameter requirements guide: parameter passing methods, value passing and address passing Mar 02, 2024 pm 05:18 PM

Guide to Golang formal parameter requirements: parameter passing methods, value passing and address passing. In the process of learning the Golang programming language, it is very important to understand the parameter passing methods and the concepts of value passing and address passing. This article will delve into the formal parameter requirements in Golang, including the difference between parameter passing methods, value passing and address passing, and provide specific code examples to help readers better understand. 1. Parameter passing methods In Golang, there are two methods of parameter passing for functions: passing by value and passing by address. Pass by value (pass a copy): When the function is called, the actual

C++ function pointer parameter passing mechanism C++ function pointer parameter passing mechanism Apr 19, 2024 pm 02:06 PM

The function pointer is used as a parameter passing mechanism in C++: the function pointer is passed as a constant pointer, a copy is created during the passing process, the received function formal parameter points to the copy, and the dereferenced copy can call the underlying function.

golang function map passed as parameter golang function map passed as parameter Apr 22, 2024 am 11:42 AM

In Go, function maps can be passed as parameters of functions, providing code reuse and customization capabilities: Create a function map: use the map[string]interface{} type, with the function name as the key and the function itself as the value. Pass as parameter: Use the funcMap type in the function parameter list to accept a function map. Execute a function: Retrieve the function from the function map via the reflect package and call it with variable arguments. Practical case: Function mapping can be passed to the template engine to dynamically execute template functions at runtime.

See all articles