Solved

Ajax beginner question

Posted on 2014-04-28
3
198 Views
Last Modified: 2014-04-28
Really just looking for someone to explain the following code. I'm going to keep moving on but it would be appreciated.

Ok so the handler, it seems to me well the syntax is a loop. Can someone explain this concept? I don't see why you can't just have an on click. Is it basically keeping it running keeping the code executing until someone does click? I know that's off.

Second question I get what's going on with the on click and the URL being rendered. I don't get the getDetails(this.title);. I put comments over that code. Not sure what that does.

Final question should I just move through this stuff or is it acceptable to post questions on here?

One more question is this considered or what I will be learning object oriented programming? I have heard that is a modern concept and I have no knowledge of it.
thumbnails.js
0
Comment
Question by:burnedfaceless
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
BigRat earned 500 total points
ID: 40027128
This is a typical piece of code which fills out functionality from a server side generated HTML page. Assume that the server has generated a load of images to be displayed on the page (an unknown number of course!) and has included them probably under a DIV element whose ID is thumbnailPane. Then a collection of these image elements is in thumbs after line 5.

We now go through this list, taking each in the variable "image" and we create an onclick function which will modify the src attribute of the image - ie: from where the picture data is loaded - by changing the URL to images/<somename>-details.jpg. The some name is the title attribute of the image tag.

When the onclick function, which has been registered as above is called, the "this" variable points to the HTML element which caused the function to be called, ie: the image tag. Thus this.title refers to the title attribute of the image which was clicked. If you think about it, any function like onclick, or mouseover and so on, must somehow have a reference to the object which was clicked ot under the mouse. This reference is called "this".

HTH
0
 

Author Closing Comment

by:burnedfaceless
ID: 40027155
Cool man it seems a little out of order but I"m trying to rap my brain around it.
0
 

Author Comment

by:burnedfaceless
ID: 40027208
No it makes perfect sense now. Thank you.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is basically two types of AJAX request in mootools. Request  and Request.HTML Request: Request is the basic XHR request class in MooTools. While not extremely useful on its own, it provides the basic functionality for both Request.HTM…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question