adding various products in favorite list

Hi i know how to add the various products in my list. like i can click on the link, it will go to another page, add the link and come back to say link added to database.

But i want to do it jquery way ..

like i have dynamic values in my link, i am trying is:

click on a link and it will add to the database and show an alert to the user, Added Successfully. if user tries to add the same, it should prompt an error.

Well i know this is possible using jquery but i am noob in jquery, so please guide me in this context
LVL 16
Gurpreet Singh RandhawaCEOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why jquery when you are using Coldfusion?

Set up an onClick to call   Coldfusion.navigate(theURL, theDIV);

use CFDIV to place a small box where you want your message to appear on your screen, whatever you name your CFDIV, make sure you put in the above where it says theDIV

theURl is the Coldfusion template adds the favorites, once added it shows "Added" in your cfdiv

<input type=button onClick="Coldfusion.navigate("add.cfm?theID=123", "resultBox");">

<cfdiv name="resultBox" style="width:100px;height:20px;">

where add.cfm adds theID to your favorites list (in the database) and the display the success message


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gurpreet Singh RandhawaCEOAuthor Commented:

i got Coldfusion is not defined..

this is the reason why i prefer jquery because coldfusion sometimes show this error: now i have also added the cfajaximport tags="cfdiv"/>

buts still problem persists!
> this is the reason why i prefer jquery because coldfusion sometimes show this error

you never get a jquery error when you don't enter the information correctly?

This Coldfusion.navigate function is javascript,  just like jquery, it is case sensitive.  


There are of course no #s around the function

Feel free to show your code...   If you wish to do jquery, go ahead..

Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

> now i have also added the cfajaximport tags="cfdiv"

This imports Coldfusion javascript functions that may be INSIDE the cfdiv.   Your Coldfusion navigate is in the same file as the CFDIV so this has no effect
Gurpreet Singh RandhawaCEOAuthor Commented:
so why it does not work i am on cf9.

well i am reading some docs on why this error is coming up!

i run the cf9 on IIS and it works fine with windows 7
sorry, I am not running CF 9 yet.  I would hope they are compatible, but I'm not sure
Gurpreet Singh RandhawaCEOAuthor Commented:
ok got it working btw:

it was coldfusion i changed it to ColdFusion and it works but now when i click the button i get the following:

Error replacing HTML, element not found: resultBox [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

While i am using it like this:

<input type="button"
      onclick="ColdFusion.navigate('list.cfm?ID=#val(ID)#', 'resultBox');" value="Add to My List">

beneath it i have the following:

<tr><td colspan="4" align="center"><cfdiv name="resultBox" style="width:100px;height:20px;"></cfdiv></td></tr>

try giving it the ID

<cfdiv id="resultBox" name="resultBox" style="width:100px;height:20px;"></cfdiv>

Gurpreet Singh RandhawaCEOAuthor Commented:
Worked! i just the name of the cfdiv to ID

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.