I am trying to use two selectors. When the first is selected, it should populate the second using records from a custom table I created within the wordpress database.
To do this I tried to use the following tutorial: http://www.1stwebdesigner.com/wordpress/implement-ajax-wordpress-themes/
The first selector name is called: parent_Select
The second selector name is called: secondary_Select
I've always made the assumption that the below is PHP code...I just don't have much familiarity with Javascript and AJAX.
The following block of code is giving me problems:
$(function(){
$('#parent_Select').change(function()
{
var $parentID=$('#parent_Select').val();
// call ajax
$("#secondary_Select).empty();
$.ajax(
{
url:"/wp-admin/admin-ajax.php",
type:'POST',
data:'action=my_special_action&selectParentID=' + $parentID,
success:function(results)
{
/ alert(results);
$("#secondary_Select").removeAttr("disabled");
$("#secondary_Select").append(results);
}
});
});
})
Could someone please let me know what might be off? Thank you!