Jump to content
Killersites Forums

Ajax Function Variable Query


Recommended Posts

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

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...