10 posts
  • 6 Years of Membership
  • Collector Level 2
  • United States
gillweb
says

I am making a script for a client that would automatically populate the next drop down depending on the first drop down selection.. like this:

Select Make Of Vehicle: FORD

Select a Model: FUSION – FOCUS – TAURUS

etc…

I have yet to conquer AJAX but feel confident enough to do this through java script. My question here is: Would there be a problem with a javascript doing this with instead of AJAX due to web page loading? There would be alot of information in the selects since it’s going to be car makes and models. Any input on why i shouldn’t do it Javascript only?

Thanks…

1173 posts
  • 6 Years of Membership
  • Australia
  • Author Level 5
  • Beta Tester
+4 more
Motionreactor
says

AJAX is JavaScript….

“is a group of interrelated web development techniques used on the client-side to create interactive web applications or rich Internet applications.” – wikipedia

You may be thinking of AJAX being all about jQuery or MooTools, which are AJAX centric in their design… but they are very useful frameworks which make JavaScript easier by providing common functionality to solve common web development needs.

Hopefully that clears up your confusion.

10 posts
  • 6 Years of Membership
  • Collector Level 2
  • United States
gillweb
says

I realize AJAX is Javascript but it also uses PHP or some other Server side language doesn’t it?

1173 posts
  • 6 Years of Membership
  • Australia
  • Author Level 5
  • Beta Tester
+4 more
Motionreactor
says
I realize AJAX is Javascript but it also uses PHP or some other Server side language doesn’t it?

Well it is true, this kind of use it quite common. You can just access the data from an XML file though, without the use of a server side language. Or, yes as you suggested… it can be completely contained in JavaScript, but then your data is embedded (which may or may not be an issue).

10 posts
  • 6 Years of Membership
  • Collector Level 2
  • United States
gillweb
says

And that is where my question is. If using JS solely and having all of my options and arrays in a .js file will that be a problem and possibly slow down the webpage?

156 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 1
  • Collector Level 2
+1 more
Subeli
says

gillweb i can make this functionality for you in AS3 and XML . If you are interested contact me throughout my contact form

10 posts
  • 6 Years of Membership
  • Collector Level 2
  • United States
gillweb
says
And that is where my question is. If using JS solely and having all of my options and arrays in a .js file will that be a problem and possibly slow down the webpage?

I believe I can do the javascript myself but would it slow the webpage down to have all the options in the script itself? Would it be ‘better’ or safer to use an AJAX pulling from XML or database?

640 posts
  • Affiliate Level 8
  • Author Level 14
  • Collector Level 4
  • Front Page Master
+12 more
Kriesi
says

to my mind it all comes down to how much data you need to load. if your initial pageload can handle loading all data upfront without slowing the page down then hiding the select boxes sound like a better option to me, since your form elements will respond faster when only using javascript and DOM Manipulation.

If you need to load alot of data (few hundred KB) then it might be smarter to load only requested data and do a few ajax requests when somehting changes..

10 posts
  • 6 Years of Membership
  • Collector Level 2
  • United States
gillweb
says

Does an external .js file load immediately when the page loads or not until it’s called?

1173 posts
  • 6 Years of Membership
  • Australia
  • Author Level 5
  • Beta Tester
+4 more
Motionreactor
says
Does an external .js file load immediately when the page loads or not until it’s called?

If you reference it in the head it will load with the page, however I think the sequence of loading may mean you need to wait for the page to complete (the HTML DOM at least) and then initialise the script. jQuery has great functions that make this easier.

by
by
by
by
by
by