0

I have applied ajax on fill email address. After enter email address ajax is running and taking address and fill like below

$('input[name="firstname"]').val(obj.addressData['firstname'])

But after click on submit button it is showing error message "This is a required field."

1 Answer 1

0

This is a simple reference:

// this is the id of the form

$("#idForm").submit(function(e) {

    e.preventDefault(); // avoid to execute the actual submit of the form.

    var form = $(this);
    var actionUrl = form.attr('action');
    
    $.ajax({
        type: "POST",
        url: actionUrl,
        data: form.serialize(), // serializes the form's elements.
        success: function(data)
        {
          alert(data); // show response from the php script.
        }
    });
    
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.