Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Roshan's Ajax dropdown code with php
- // This notice must stay intact for legal use
- // Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com
- // If you have any problem contact me at http://roshanbh.com.np
- function getXMLHTTP() { //fuction to return the xml http object
- var xmlhttp=false;
- try{
- xmlhttp=new XMLHttpRequest();
- }
- catch(e) {
- try{
- xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch(e){
- try{
- xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch(e1){
- xmlhttp=false;
- }
- }
- }
- return xmlhttp;
- }
- function getSubCat(catId) {
- var strURL="../Includes/subcatAds.php?cat="+catId;
- var req = getXMLHTTP();
- if (req) {
- req.onreadystatechange = function() {
- if (req.readyState == 4) {
- // only if "OK"
- if (req.status == 200) {
- document.getElementById('subcat').innerHTML=req.responseText;
- } else {
- alert("There was a problem while using XMLHTTP:\n" + req.statusText);
- }
- }
- }
- req.open("GET", strURL, true);
- req.send(null);
- }
- }
- function getDept(deptId) {
- var strURL="../Includes/dept.php?dept="+deptId;
- var req = getXMLHTTP();
- if (req) {
- req.onreadystatechange = function() {
- if (req.readyState == 4) {
- // only if "OK"
- if (req.status == 200) {
- document.getElementById('dept_ht').innerHTML=req.responseText;
- } else {
- alert("There was a problem while using XMLHTTP:\n" + req.statusText);
- }
- }
- }
- req.open("GET", strURL, true);
- req.send(null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement