How does php js pass values on different pages?

Source: Internet
Author: User
How does php js pass values on different pages? Is there a simple method that js does not need to parse the received string?


Reply to discussion (solution)

Php cannot actively send data to js
So you should clarify your ideas first.

Php cannot actively send data to js
So you should clarify your ideas first.

What does it mean? On the js page, I need to get a value generated by php.

Js? Ask for php? Face ,? Php? ??.

Http://www.w3school.com.cn/jquery/ajax_ajax.asp

$(document).ready(function(){  $("#b01").click(function(){  htmlobj=$.ajax({url:"/jquery/test1.txt",async:false});  $("#myDiv").html(htmlobj.responseText);  });});


Php cannot actively send data to js
So you should clarify your ideas first.

What does it mean? On the js page, I need to get a value generated by php.



$ (Function (){
$ ("# Str"). val (" ");
})

Php cannot actively send data to js
So you should clarify your ideas first.




I regret using a large brush to solve the problem.

Ajax request ~~ On the htm page, you can get the data from the php side. if it is a number or something, you can directly output the data. other data can be transmitted in json format.

Let's talk about what you want. What kind of effect will be achieved.

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.