473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

to ajax or not


I am fixing up a site where the address data for all the addresses for
each customer is called with 1 query and then added to a javascript
array. The street name of each shipping addresses is available in a
dropdown menu. When an address is chosen, the details are displayed
for editing in input fields under the menu.

The addresses are either US , international or military addresses.
Most of the fields are common to all types of addresses, buy each type
of address also has some unique fields. When the address is chosen, I
want only the relevant fields to display.

Option 1: The site originally had all the fields on each page no
matter which type of address was selected. Each field was made
visible or invisible as needed with javascript, but this left empty
spaces where the unused fields were.

Option 2: I could create the unique fields with ajax, and then fill
them in with data from the address array. I tried this, and it seems
like the script tries to validate the fields before they are created,
even if the validation comes after the ajax call. I don't like the
idea of using a timer, so is there any other way to have the script
wait until the ajax section is done before proceeding ?

Option 3: I could call only the address ids and street names when the
page loads, and then use ajax to call and display the address data for
each address when the user chooses it. This means a query for each
address, but that doesn't seem like a big deal.

Option 4:I could forget ajax calls entirely and use javascript to
construct and delete only the unique input fields as they are needed.
This seems javascript heavy, but it works fine and I'm leaning in this
direction.

What's the right way to do this ?

Jun 12 '07 #1
2 1342
gr*****@reenie.org wrote:
>
I am fixing up a site where the address data for all the addresses for
each customer is called with 1 query and then added to a javascript
array. The street name of each shipping addresses is available in a
dropdown menu. When an address is chosen, the details are displayed
for editing in input fields under the menu.

The addresses are either US , international or military addresses.
Most of the fields are common to all types of addresses, buy each type
of address also has some unique fields. When the address is chosen, I
want only the relevant fields to display.

Option 1: The site originally had all the fields on each page no
matter which type of address was selected. Each field was made
visible or invisible as needed with javascript, but this left empty
spaces where the unused fields were.

Option 2: I could create the unique fields with ajax, and then fill
them in with data from the address array. I tried this, and it seems
like the script tries to validate the fields before they are created,
even if the validation comes after the ajax call. I don't like the
idea of using a timer, so is there any other way to have the script
wait until the ajax section is done before proceeding ?

Option 3: I could call only the address ids and street names when the
page loads, and then use ajax to call and display the address data for
each address when the user chooses it. This means a query for each
address, but that doesn't seem like a big deal.

Option 4:I could forget ajax calls entirely and use javascript to
construct and delete only the unique input fields as they are needed.
This seems javascript heavy, but it works fine and I'm leaning in this
direction.

What's the right way to do this ?
Well, I can't say this is the right way, but wouldn't Option 1 work if
you use "display:none" to hide the irrelevant items? They wouldn't take
up space in the layout.
Jun 12 '07 #2
On Jun 12, 3:40 pm, Gary Hasler <garyhas...@thelogconnection.com>
wrote:
grou...@reenie.org wrote:
I am fixing up a site where the address data for all the addresses for
each customer is called with 1 query and then added to a javascript
array. The street name of each shipping addresses is available in a
dropdown menu. When an address is chosen, the details are displayed
for editing in input fields under the menu.
The addresses are either US , international or military addresses.
Most of the fields are common to all types of addresses, buy each type
of address also has some unique fields. When the address is chosen, I
want only the relevant fields to display.
Option 1: The site originally had all the fields on each page no
matter which type of address was selected. Each field was made
visible or invisible as needed with javascript, but this left empty
spaces where the unused fields were.
Option 2: I could create the unique fields with ajax, and then fill
them in with data from the address array. I tried this, and it seems
like the script tries to validate the fields before they are created,
even if the validation comes after the ajax call. I don't like the
idea of using a timer, so is there any other way to have the script
wait until the ajax section is done before proceeding ?
Option 3: I could call only the address ids and street names when the
page loads, and then use ajax to call and display the address data for
each address when the user chooses it. This means a query for each
address, but that doesn't seem like a big deal.
Option 4:I could forget ajax calls entirely and use javascript to
construct and delete only the unique input fields as they are needed.
This seems javascript heavy, but it works fine and I'm leaning in this
direction.
What's the right way to do this ?

Well, I can't say this is the right way, but wouldn't Option 1 work if
you use "display:none" to hide the irrelevant items? They wouldn't take
up space in the layout.
You know what? I think that is the best overall method. Thanks for the
tip!
If I had thought of that I probably wouldn't have thought of all the
other methods.

Jun 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
0
by: melledge | last post by:
Ajax Developers' Day added to XTech 2006 agenda XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The Netherlands
0
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
10
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
controlsPlease could some of you here post some of your live examples of AJAX (esp drag panels, collapsable panels, and popup menu.) (It's one thing to talk about how great something is, but it's...
2
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
1
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.