Empty POST from jQuery UI Dialog to PHP function with $.post

Posted by solefald on Stack Overflow See other posts from Stack Overflow or by solefald
Published on 2010-05-20T15:40:32Z Indexed on 2010/05/20 15:50 UTC
Read the original article Hit count: 388

Filed under:
|
|
|

Hello,

I am having hell of a time trying to figure this one out. Maybe someone can help me here or point me in the right direction.

I have a jQuery UI dialog that pops up when user clicks on an image. The dialog displays a form with 2 drop down windows. "dept" and "group". Group drop down is disabled, until something is selected in the "dept" dropdown menu.

When user selects a department, I do a POST to php function and then enable and populate the group drop down. Simple enough...

<select name="dept" id="dept_select" onchange="getDeptGroups(this.value);">
 // Some data here
</select>

JS function:

function getDeptGroups(dept)
{
       // This alert works and displays department name.
       //alert(dept);

       $.post("/am/ldap/getDepartmentGroups.php", { 
              department: dept },
              function(data){
                    alert(data);
       });
}

and finally in php page i just do

<? print_r($_POST); ?>

and end up with empty array.

Array
(
)

This happens in both, Chrome and Firefox, however, FireBug clearly shows post data being submitted:

Screenshot of FireBug showing POST data

What am i doing wrong here?

© Stack Overflow or respective owner

Related posts about php

Related posts about jquery-ui