0

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
&lt; - the < character
&gt; - the > character
&apos; - the ' character
&quot; - 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.

0

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.

Hi, thanks for the info
How should we do this ?

0

Hi Tanha,

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;
0

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.

0

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.

Excellent , works for me:)

I wanna use this application to make a cascading drop down list able to Search and hence find more information about the selection made (display a description, pictures etc...)! Instead of having the reset button. I know is not easy and I am a complete noob with ajax. I would appreciate your help.....ty

P.S. Hi all !

0

I wanna use this application to make a cascading drop down list able to Search and hence find more information about the selection made (display a description, pictures etc...)! Instead of having the reset button.

I'm not sure I understand what you're asking for. Can you give me a little more detail about what you're trying to do?

0

I'm not sure I understand what you're asking for. Can you give me a little more detail about what you're trying to do?

Hi m8,

I am thinking of making a database populated with various businesses of a specific sector i.e. hotels (like a directory), and store names,location,emails, telephone numbers, pictures etc in there. Then using this ajax Cascading Dropdown list one could search my database according to his criteria based on location and price for example (or location, price and type of hotel etc) and perform then a multiple search in my database and hence dispaly results accordingly. In short, (if you have run the application/script) replace the Reset button , with a Search button.

Hope I managed to make myself understood.

Ty in advance! :)

0

Ah, I see.

There's no need to "replace" the Reset button with a Search button. That's the part that was throwing me. Reset just resets the values of the select tags. Adding a Search button should be easy enough. What do you have so far?

0

M8,

Havent looked in to it yet. Been busy:( . Not so sure if this as easy as it looks. I am a noob anyway. Guess I will have to make a query to my database when menus are populated with ajax and also add a javascript search button??? pfff, I will look into it hopefully soon.

BTW any idea about jquery? Will this be of any use in this case?

Cheers:)

0

Guess I will have to make a query to my database when menus are populated with ajax and also add a javascript search button???

That sounds reasonable.

BTW any idea about jquery? Will this be of any use in this case?

I've never used jquery, so I really couldn't tell you how useful it would be.

Once you get started, let me know if you're struggling with anything and I'll see what I can do to help.

0

Hi here is a good example of how to do a cascading drop down using mysql:
<URL SNIPPED>Cascading drop down in PHP using AJAX

0

hello ,

am using same of the attached code and its works ! thanks guys :)

but i want to post both faculty and department selected input from the user to other page (search.php) the faculty name i know it from the form post , but how can i know what user select in department dropdown ?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.