Jump to content

<a href> and Javascript with PHP


never_rain

Recommended Posts

This is something very simple but no able to handle it. I am trying to do two things by one click. I would like to call a function in Javascript that'll simply display the div. Till this part, there is no problem. But at the same time, I wish to pass a variable id so that the div can use that variable to fetch values from the table. Here is what I am doing.

 

<a href="javascript:addEducation();">

 

 

This one works fine. But when I try to send a variable, it wont do any thing. Not even this function will work.

 

<a href="javascript:addEducation()?id=3;">

 

 

I know its very simple but Just not been able to handle it. Quick reply will really help.

 

Thanks.

Link to comment
Share on other sites

Firstly, there really is no need to mix JavaScript in with your markup these days. There are plenty of frameworks around that make unobtrusive code simple to achieve. You should look into using one of them.

 

Secondly, you would need to pass the I'd numbers into your addEducation function, it's not a URL.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.