How to pass both action and formdata in wordpress ajax?

try to add the action in the formdata :

        var formData=new FormData(document.getElementById('landlordregform')); 

        formData.append("action", "custom_landlord_registration_process");   

        jQuery.ajax({
            url: jQuery("#cusajaxurl").val(),
            type: 'POST',
            data: formData, 
            cache: false,
            processData: false, 
            contentType: false,     
            success: function(data) {
                console.log(data);
            }
        });

Leave a Comment