Hello,
This is week two of learning javascript / jQuery so please forgive me
if you find simple mistakes ;)
++ You will notice below my functions behind with \$. This is running
in a perl script, and perl uses $ as variable deleration, so it needs
to be escaped first. (No big deal)
Anyway. I have a nice click routine that I've made with jQuery:
\$(".button").livequery('click', function() {
var color = \$("input#color_code").val();
\$(this).css({ backgroundColor:color });
color = color.substr(1);
var id_select = \$(this).attr("id");
id_select = id_select.substr(1);
\$("#result").load('/pixel/pixel_creator.pl', {colorselect: color,
id_select: id_select});
return false;
});
Basically what is going on here, is a users has a value in the color
input box lets say "#FFFFFF" then we take the color and when someone
clicks on a list of a few divs, the button will change to that color
(just for looks initially), save the color for processing (removing
the # symbol), grab the ID of the cell they clicked and then submit
that into a perl script. There is about a 4 second delay however
before the perl script gets the values of what the user entered. I use
to have this script sent via .ajax instead of .load.
~ My question is, is there a better, faster way to do all of this?
(More specifcally the sending of the values to the perl script.)
Thank you for any help you can provide! ;)
- Tri