Wordpress boilerplate plugin url parameter not working

59 Views Asked by At

I have a problem with jquery. Jquery redirects to domain.com/wp-admin/admin.php + form values instead ajax_admin.php I have other jquery calls with same url ajaxurl(ajax_admin.php) and they work. This call is getting info from form but it seems that url parameter is not working. Also it seems that action doesn´t go through also since it´s not in the redirected url. Redirected url looks like this - domain.com/wp-admin/admin.php?name=name&phone=phone What am i doing wrong?

jQuery('#add_db').submit(function(e){
        var form_data = jQuery(this).serialize();
        jQuery.ajax({ 
            url: ajaxurl,
            data: {action: 'add_bookingdb', form_data},
            type: 'post',
            success: function(data) {
                console.log(data); 

            }
        });
    });
0

There are 0 best solutions below