请问关于php中使用ajax实现菜单联动查询的思路和方法

WBOY
Release: 2016-06-13 10:56:45
Original
713 people have browsed it

请教关于php中使用ajax实现菜单联动查询的思路和方法
我有两个select选择框,一个文本框
目前第一个已经加载了项目分类
希望通过选择第一个select,无刷新加载第二个select
再通过选择第二个select,无刷新给文本框加载查询到的名称

网上方法尝试过一二,但都有些不明的问题存在。
希望有高手指教一个具体点的思路或者实现方法。谢谢指教
就和发帖下面 选择论坛的功能中两个select一样

------解决方案--------------------
select的onchang事件给ajax传值,再到接收值的页面做一个sql查询。为的是给你的第二个select用,sql的返回值给到ajax做接收
------解决方案--------------------
var sel=document.getElementsByTagName("select");
这是取得页面所有 select 下拉框。明显有问题,你应该根据id来取

要取得兼容的xhr 对象,应该想下面这样:
if (window.XMLHttpRequest)
{ // code for IE7+, Firefox, Chrome, Opera, Safari
var xhr=new XMLHttpRequest();
}
else
{ // code for IE6, IE5
var xhr=new ActiveXObject("Microsoft.XMLHTTP");
}

Related labels:
source: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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!