aleverett Posted May 12, 2010 Report Share Posted May 12, 2010 I'm currently following your ajax shopping cart tutorial (great tutorial by the way). I was hoping someone could shed some light on one thing I can't quite understand. It's this bit on Part 8 of the videos: - (ive deleted the code in-between to just show the line i mean) function handleSearchResults(results) { productListXml = results; var total = results.getElementsByTagName("result").length; What I don't understand is, what value is held in the variable 'results' which is passed in the function handleSearchResults(results) The variable productListXml is then assigned the value of 'results' but what value is this? And how does it get this value? thanks Quote Link to comment Share on other sites More sharing options...
BeeDev Posted May 12, 2010 Report Share Posted May 12, 2010 I haven't done the tutorials but it looks to me the variable "results" that's passed to the function is an XML DOM object: var total = results.getElementsByTagName("result").length; This line gives it away, as you can only perform this method (getElementsByTagName) on a DOM object. Quote Link to comment Share on other sites More sharing options...
aleverett Posted May 12, 2010 Author Report Share Posted May 12, 2010 Thanks for that! I haven't done the tutorials but it looks to me the variable "results" that's passed to the function is an XML DOM object: var total = results.getElementsByTagName("result").length; This line gives it away, as you can only perform this method (getElementsByTagName) on a DOM object. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.