And it had no chance to work correctly.
When you use wp_localize_script
like that:
wp_localize_script( $handle, $name, $data );
then the object called name
is defined and data
is it’s content. As you can see in this example from Codex.
So you can’t use ajaxurl
in your JS file, because there is no such variable defined anywhere in your code.
The correct way is:
var request = $.ajax({
type: "POST",
url: ajax_custom.ajaxurl,