0

Everytime I used ajax for posting, I'm getting this error but the passing of data works successfully. Some said that it is because of my return statement. I also don't have any mapping for /error. This is one of my work that causes this error.

AJAX:

$.ajax
({
type: 'post',
url: '/SaveDependent',
data: 
{
    dependent_id: 0,
    reference_no: referenceNo,
    dependent_name: dNameValue[i],
    dependent_dob: dDobValue[i],
    dependent_gender: dGenderValue[i],
    dependent_occupation: dOccupationValue[i],
    dependent_relationship: dRelationshipValue[i],
    dependent_beneficiary: dBeneficiaryValue[i]
},
success: function (response) 
{
    alert("success");
},
});

CONTROLLER:

@RequestMapping(value= "/SaveDependent", method=RequestMethod.POST)
public String saveDependent(ClientApplicationDependent clientApplicationDependent) {
        clientApplicationDependentService.saveOrUpdate(clientApplicationDependent);
        return "success";
}

SERVICE:

public interface ClientApplicationDependentService {
    public void saveOrUpdate(ClientApplicationDependent clientApplicationDependent);
}

SERVICE IMPL:

@Override
public void saveOrUpdate(ClientApplicationDependent clientApplicationDependent) {
    clientApplicationDependentRepository.save(clientApplicationDependent);
}
trumanblack1025
  • 471
  • 2
  • 8
  • 19

0 Answers0