I'm making a jQuery Ajax POST request to a PHP script that returns an HTML select menu complete with all its options.
$.ajax({
type: "POST",
url: "books/editions",
data: dataString,
cache: false,
success: function(menu) {
$('#editions').html(menu);
}
});
Debugging tells me that the PHP script is executed properly and is returning the HTML select menu as expected. However, Firebug is telling me that 'menu' is undefined -- and obviously nothing is loaded into the '#editions' div.
I was expecting 'menu' to contain the HTML string returned from the PHP function, but this doesn't appear to be the case. Can someone tell me what I'm doing wrong? Thanks in advance.
--
As requested, the PHP editions() method code:
public function editions()
{
$menu = $this->books_repository->get_editions_menu();
return $menu;
}
Again, debugging at the return point tells me that the method is returning an HTML string that is properly formatted with the correct contents.