•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,990 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,296 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2472 | Replies: 34 | Solved
![]() |
hi,
I am here giving answers to two questions.
1. & gives error: This is because some characters are reserved characters in XML and & is one of them, so if you need & in description then you will need to entity references.
some examples are as follows:
& - the & character
< - the < character
> - the > character
' - the ' character
" - the " character
2. AJAX, cookies needs to be deleted frequently: This is because when AJAX calls a page, it searches for it first in cache, so the changes if any have been done will not be reflected.
To prevent it, always add a randam value in querystring when calling a page.
This will let AJAX know that we need a page from server and not from Cache.
Hope these things will help you guys.
I am here giving answers to two questions.
1. & gives error: This is because some characters are reserved characters in XML and & is one of them, so if you need & in description then you will need to entity references.
some examples are as follows:
& - the & character
< - the < character
> - the > character
' - the ' character
" - the " character
2. AJAX, cookies needs to be deleted frequently: This is because when AJAX calls a page, it searches for it first in cache, so the changes if any have been done will not be reflected.
To prevent it, always add a randam value in querystring when calling a page.
This will let AJAX know that we need a page from server and not from Cache.
Hope these things will help you guys.
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
Hi Tanha,
when you create a xml request, you create a url somewhat like this, right?
just add dat time to it, it will never be used but will make the page request a new request everytime.
when you create a xml request, you create a url somewhat like this, right?
requestUrl = "xml_data_provider.php?level="+index+"&parent=" + selectedItem;
just add dat time to it, it will never be used but will make the page request a new request everytime.
requestUrl = "xml_data_provider.php?level="+index+"&parent=" + selectedItem+"&"+date;
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
•
•
Join Date: Sep 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
Thanks to all of your guidance (this was my first time playing with AJAX), I've come up with a more configurable version of the cascading dropdown list code that my fellow Ajax-noobs might find helpful.
Here is what's in the attached zip:
AjaxCode.js - this is essentially the same as the other javascript files that have been posted here with a few minor tweaks.
data_settings.php - this is a file that's included in the php pages that query the database. It contains the hostname, username, password, and database name for the database that will house the tables, creates the database connection and selects the database.
index.php - this is a more dynamic main page that builds itself using two tables. The first table, ajax_data, contains all the data to be placed in the dropdowns. The second table, ajax_labels, contains the descriptions labels for each dropdown and more importantly, an id field that determines the value passed in the onchange event to load the dependent dropdown options.
tables.sql - this is the sql to build and fill the generic tables used by the code. You can add any number of dropdowns by adding records to ajax_labels and ajax_data with the proper corresponding id (in the label table) and parent & level (in the ajax_data table).
xml_data_provider.php - this is essentially the same file as was attached in the first post, with the required tweaks to make it work.
I've corrected the problem with the multi-level loading and added a button to reset the select controls.
I hope somebody finds it useful. If not, it was still fun coming up with the solution.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Previous Thread: Publishing php/mysql on Apache website
- Next Thread: How many queries can be preformed in one click?


Linear Mode