There is wood in PHP to get the value of JS

Source: Internet
Author: User
Recently in the study Discuz, which modifies the code when you want to assign JS value to the Discuz global variables, there is a great God know how to do? Or the PHP method to get the value of JS can also


Reply to discussion (solution)

PHP is not the value of JS, but the value of JS passed to the server! The front end can typically pass data to the backend in two ways: Post GET

$user = $_post[' user ']; Get post value in PHP $pass = $_get[' pass '); Get a Get value in PHP

And the value of the pass is generally passed through the Ajax way!
So it is not PHP to get the value of JS, but JS to pass the data to the server, and then PHP read the post get global array!

PHP is not the value of JS, but the value of JS passed to the server! The front end can typically pass data to the backend in two ways: Post GET

$user = $_post[' user ']; Get post value in PHP $pass = $_get[' pass '); Get a Get value in PHP

And the value of the pass is generally passed through the Ajax way!
So it is not PHP to get the value of JS, but JS to pass the data to the server, and then PHP read the post get global array!


For example, I wrote a JS on the current page, and then want to get this value in the current page, how to write?

What you say is generally used in Ajax, the order in which the pages are executed is to wait until the PHP language parsing is complete before parsing the HTML code,

What you say is generally used in Ajax, the order in which the pages are executed is to wait until the PHP language parsing is complete before parsing the HTML code,


How can I write this?


What you say is generally used in Ajax, the order in which the pages are executed is to wait until the PHP language parsing is complete before parsing the HTML code,


How can I write this?


Are you writing HTML PHP and JS together? It is recommended to separate each file!
http://www.w3school.com.cn/php/php_ajax_suggest.asp example on W3



What you say is generally used in Ajax, the order in which the pages are executed is to wait until the PHP language parsing is complete before parsing the HTML code,


How can I write this?


Are you writing HTML PHP and JS together? It is recommended to separate each file!
http://www.w3school.com.cn/php/php_ajax_suggest.asp example on W3


Not I write together, is in DZ directly modify, I also can't

First, the order of execution of the server and client is clear.
PHP is a service-side language
And JS is the client's script

The service end will be done before the client, so you have to let the server to get the value of the client, the only way is to let the client send the request to the server
Like using AJAX to request

First, the order of execution of the server and client is clear.
PHP is a service-side language
And JS is the client's script

The service end will be done before the client, so you have to let the server to get the value of the client, the only way is to let the client send the request to the server
Like using AJAX to request


Can you do this on the same page?

It should be delivered to PHP in the form of an AJAX request.

It should be delivered to PHP in the form of an AJAX request.


The problem is in the discuz inside, ordinary PHP, with Ajax can be

Discuz not provide a Ajax.get method?

Discuz not provide a Ajax.get method?


Just learn discuz, not very familiar, can you give an example? Like I'm going to make a drop-down box, and I want to assign the value of the drop-down box to $_g[' FID '.

Actually I haven't had discuz, you look at this http://www.baidu.com/s?ie=UTF-8&wd=discuz+ajax%E4%BD%BF%E7%94%A8

Actually I haven't had discuz, you look at this http://www.baidu.com/s?ie=UTF-8&wd=discuz+ajax%E4%BD%BF%E7%94%A8


Okay, I'll check it out, thank you.

Using Ajax to pass to PHP

Using Ajax to pass to PHP


Little white, can you give me an example?

 
  

PHP so you can use the variable value JS

 
  

PHP so you can use the variable value JS


Ok thanks
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.