View Full Version : A Little Help Please...

09-02-2010, 03:23 AM
Hello all,

I have a page that includes the following code:

$('addActivity').click(function() {
$("form#exercise").submit(function() {
// we want to store the values from the form input box, then send via ajax below
var activity = $('#activity').attr('value');
type: "POST",
url: "newActiveProc.php",
data: "activity="+ activity +"&func=search",
success: function(msg){

return false;


This code, coupled with a table on the page, should allow the user to add an activity to their personal table. First, they search for an activity then click 'Submit'. The user is then presenting with a list of more specific criteria based on the activity they chose. For example, if the user chooses 'Sports' from the available list and clicks 'Submit', they are then presented with a specific lists of sports (stored in a database) such as basketball, football, and so on. Next to each item in the specific list is a button that is meant to be used to add the activity to the user's table. For example:

[Add to table] Basketball
[Add to table] Football
[Add to table] Baseball

However, the 'Add to table' button is not working. I'm thinking that I need to add some type of working function to it. If that is right, can someone point me in the right direction? Based on the code I pasted at the beginning of this post, does anyone have any suggestions? Thanks in advance.

09-02-2010, 04:59 AM
I have another question: In the code above, doesn't a parameter have to be in the function (parameter) in order to pass the values to the table?

09-02-2010, 01:21 PM
This is jQuery code. You'll have more luck getting answers to questions involving jQuery in the Javascript Frameworks forum.

Regarding your question: you mean this bit?:

$('addActivity').click(function() {

I'm assuming "addActivity" is the ID of a button or a link or something? If so, you need the "#" ID selector in front of it:

$('#addActivity').click(function() {

09-07-2010, 03:03 PM
Instead of alerting the user, is there a way I can add their selection to the table within the page?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum