jQuery ajax not working in wordpress
<p>Could someone explain my why this jQuery code could not work? I'm always getting console.log(). WebsiteData.ajax_url alert prints correct url.</p>

<pre><code>$('.variations_form').submit(function () {
    var html = $('#website-textarea').html();
    //alert(WebsiteData.ajax_url);
    jQuery.ajax({
        url : WebsiteData.ajax_url,
        type : 'post',
        data : {
            action : 'post_love_add_love',
            html : html
        },
        success : function( response ) {
            alert(response);
        },
        error: function(response) {  
            console.log(response);
        }
    });
});
</code></pre>

<p>php code:</p>

<pre><code>class WebsiteIconInsertion {

    public function __construct() {
        add_action( 'wp_enqueue_scripts', array( $this, 'AddStyles' ) );
        add_action( 'wp_ajax_post_love_add_love', array($this, 'post_love_add_love') );
        add_action( 'wp_ajax_nopriv_post_love_add_love', array($this, 'post_love_add_love') );
    }

    public function AddStyles() {          
        wp_register_script( 'website-icons-js', plugin_dir_url( __FILE__ ) . 'public/js/website-icons.js');
        wp_localize_script( 'website-icons-js', 'WebsiteData', array('ajax_url' =&gt; admin_url( 'admin-ajax.php' ), 'file_path' =&gt; plugin_dir_url( __FILE__ )));
        wp_enqueue_script( 'website-icons-js' );
    }

    function post_love_add_love() {
            echo "nx";
            die();
    }
}
</code></pre>