ajax响应显示零

I'm using ajax in WordPress. the problem is while getting the response from ajax it shows "0"

my ajax response message

function verifymsg()
{
var verifymobile = $('#verifymobile').val();
var otpmobile = $('#mobile').val(); 
alert(verifymobile);
alert(otpmobile);
   var data = {
        'action': 'verifyotp_ajax',
        'verifymobile': verifymobile,'otpmobile': otpmobile
    };
    $.post(ajaxurl, data, function(response) {
        alert(response);
        $('#send').css("display", "none");
        $('#verify').css("display", "block");
    });

return false; }

This is the WordPress code

add_action('wp_ajax_sendotp_ajax', 'sendotp_ajax_callback');
add_action('wp_ajax_nopriv_sendotp_ajax', 'sendotp_ajax_callback');
function sendotp_ajax_callback() {   
$verifymobile=$_POST['verifymobile'];
$otpmobile=$_POST['otpmobile']
if($otpmobile=="success")
{
    echo "success";
}}}

At the end of echo response use exit; or wp_die(); code , it will remove zero.

add_action('wp_ajax_sendotp_ajax', 'sendotp_ajax_callback');
add_action('wp_ajax_nopriv_sendotp_ajax', 'sendotp_ajax_callback');
function sendotp_ajax_callback() {   
$verifymobile=$_POST['verifymobile'];
$otpmobile=$_POST['otpmobile']
if($otpmobile=="success")
{
    echo "success";exit;
}}}

For more help : Click here and see under heading Error Return Values .

You can use die() or exit() or wp_die() to stop execution of page after your condition getting true, so when if condition runs then it will only return 'success' and it will stop page execution.

add_action('wp_ajax_sendotp_ajax', 'sendotp_ajax_callback');
add_action('wp_ajax_nopriv_sendotp_ajax', 'sendotp_ajax_callback');
function sendotp_ajax_callback() {   
$verifymobile=$_POST['verifymobile'];
$otpmobile=$_POST['otpmobile']
if($otpmobile=="success")
{
    echo "success";exit;
}}}