I was thinking it would take me a long time to figure out how to use jquery for this application, but I guess it's been a while since I've looked at the source because I think I can already spot what I need to do. I should just be able to copy the function but change .value to whatever tag attribute I'm stashing the data in. Thanks for the heads up.
On Aug 7, 1:01 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > This is the source of the web2py ajax function: > > function ajax(u,s,t) > { > var > query=""; > for(i=0; i<s.length; i++) > { > if(i>0) query=query > +"&"; > query=query+encodeURIComponent(s[i])+"="+encodeURIComponent > (document.getElementById(s[i]).value); > } > jQuery.ajax({type: "POST", url: u, data: query, success: function > (msg) { if(t==':eval') eval(msg); else document.getE\ > lementById > (t).innerHTML=msg; } }); > > } > > As you can see it calls jQuery.ajax which is more powerful and you can > pass "data" it. I think you can do what you need using the > jQuery.ajax. > > On Aug 6, 6:55 pm, Alastair Medford <alastairmedf...@gmail.com> wrote: > > > What I'm trying to do is place information into a nornal <a> link, > > which will be sent along with an onclick ajax call. I know how to do > > this when the information is from an <input> tag just fine. But in > > this case I would like the information, like an id, to be contained > > somewhere in the <a> tag itself. > > > The reasoning behind this is I would like to build a jquery tree, and > > when a link inside is clicked, an ajax function is called that then > > "knows" which link was clicked and will act accordingly. I've tried > > sending the <a> tag along by adding its id to the arguments of the > > ajax call, but its value in request.vars ends up being undefined. I > > theoreticaly could have a hidden field with each element containing > > the id but this seems messy. Is there a better way? > > > The reason I'm not just straight out callng controller functions is > > this tree will be generated from a user made xml file. It's then used > > to find content in another user made file, so it has nothing to with > > calling certain functions. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---