1

I'm trying to access the serialized data in the var param that is sent to the admin_comment.php file. I feel like making a rookie mistake. Below is my jQuery code...

$(buildFormName).submit(function(e){


var param = $(e.target).serialize();

param = param + '&new_cid=' + theCommentId;

alert(param);

// params return as expected - look good

$.post('submit/admin_comment.php',param,function(msg){



});
});

In the admin_comment.php file I have this:

$arr = array();

And I'm trying to access an individual element of the array, new_cid like this:

$arr['new_cid'];

but it comes up empty... can anyone tell me what I'm doing wrong or point me in the right direction?

1
  • You can change the $(e.target).serialize(); to $(this).serialize() Commented Jan 13, 2012 at 21:56

1 Answer 1

3

The special array you're looking for is the PHP superglobal $_POST.

You should be able to get your data via:

$_POST['new_cid']
Sign up to request clarification or add additional context in comments.

2 Comments

oh wow. amazing that i missed that one... everything works now - thank you so much!
No problem. Welcome to PHP programming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.