Forum Moderators: open

Message Too Old, No Replies

Ajax - set variables with <a href

Is it possible?

         

AprilS

7:20 pm on Jan 18, 2007 (gmt 0)

10+ Year Member



I have a working project using Ajax and I am having difficulties sending variables. I know how to do so if I'm using <form - but I am using just links (project requirment...) So, does anyone know how I can send/embed variables within an <a href statement?

Currently I am doing the following...which works... but doesn't send variable data:

<a href='/mylink' onClick="new generate_mask(['val1'], ['resultdiv']); return false;">

generate_mask is my Ajax defined function in my script.

Any idea how I can set val1 to a value?

Fotiman

10:37 pm on Jan 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I know how to do so if I'm using <form - but I am using just links (project requirment...)

Uh... that's kind of a dumb project requirement. You can't even use hidden form fields? Also, it sounds like your application will not function at all if JavaScript is disabled... probably not a very good project design. You might want to start be re-evaluating the project requirements.

Is there any reason that you need to call generate_mask directly from the link? Could your link's onclick handler call some other JavaScript function which then calls generate_mask with the desired variables?