troubleshooting Question

ajax call on image onclick

Avatar of newbie29
newbie29 asked on
JavaScript
5 Comments1 Solution1000 ViewsLast Modified:
Hello Folks,
I have a script which does ajax call on onclick event, attached is a block of snippet used to process all the records available on the page, all it does is on ajax call is to converts tick image to cross image or cross to tick image.
Currently the script converts all tick to cross and if they are already any cross image(s) it is converting them to tick.
The change I want is instead of changing all (croos and tick) images on the page, it should only tick the images which are crossed and ignore all those images which are ticked.
This problem probably because I am calling one function from the tick and cross images?
Hielo, you probably be the best person to assist me on  this as you already have seen the code earlier.
Thanks for any help guys.
Regards
Sam
function processAll()
         {
            //obtain list of <span class="id">
            var theIds = $("span.id");
     
            for(var i=0; i < theIds.length; ++i)
            {
                    var theImage = theIds[i].getElementsByTagName("img")[0];
                    var theId = theImage.className.replace("id_","");
                    //var theValue =  ( (theImage.src.indexOf("avail_yes") > -1) ? "Y":"N");
                    var theValue =  ( (theImage.src.indexOf("avail_yes") > -1) ? "N":"Y");
                    // ajax call
                    makeAjaxRequest(theId, theValue);
            }          
         }
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros