Home  >  Article  >  Backend Development  >  不同页面,php如何js传值?

不同页面,php如何js传值?

WBOY
WBOYOriginal
2016-06-23 13:40:131147browse

有没有简单的方法,js不需要对接收到的字符串进行解析?


回复讨论(解决方案)

php 不可能主动的向 js 发送数据
所以你先把思路理清楚了再说

php 不可能主动的向 js 发送数据
所以你先把思路理清楚了再说

什么意思?我在js页面需要得到php产生的一个值

js 去?求 php ?面,?取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 不可能主动的向 js 发送数据
所以你先把思路理清楚了再说

什么意思?我在js页面需要得到php产生的一个值

$(function(){
$("#str").val("");
})

php 不可能主动的向 js 发送数据
所以你先把思路理清楚了再说




后悔用大号刷了,大大求解封

ajax请求啊~~在htm的页面就能拿到php那边的数据了,要是数字什么的,直接输出就可以,其他的可以用json格式传输

先说清楚你想干什么。打算实现什么样的效果。

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