A 0 status from admin-ajax.php indicates that no “action” is being parsed.
When you enqueue the script you are assigning a handle, this handle needs to be used when you use wp_localize_script and additionally you need to assign the url.
https://codex.wordpress.org/Function_Reference/wp_localize_script
wp_register_script( 'some_handle', 'path/to/myscript.js' );
wp_localize_script( 'some_handle', 'object_name', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) );
wp_enqueue_script( 'some_handle' );
Then for the JS correctly call the URL
jQuery.ajax({
url : object_name.ajax_url,
type : "POST",
dataType: "json",
data : {
data : data,
action : "bakkah_register_session"
},
success : function(response){
jQuery(".message_register_bakkah").html(response);
jQuery("#bakkah_submit_button").removeAttr("disabled");
obj[0].reset();
console.log (response);
},
error: function(response) {
console.log(response);
}
});
Also in your PHP you need to actually return something from the function for jQuery to process and whatever you return needs to be a json_encoded array.
$whatever['type'] = 'Success';
$whatever['message'] = 'Some returned msg string';
return json_encode( $whatever );
Within your jQuery script you would then refer to these values as response.type
and response.message
allowing you to perform checks….
success : function(response){
if( response.type == 'success') {
// do something
}
else {
// Failed, do something else
}
}