Conditionally create ajax url parameter to use with jQuery Validate

Conditionally create ajax url parameter to use with jQuery Validate

Hi all,

I have an issue. I need to dynamically append some data to the url in the remote method when doing an ajax request with jquery validate. Below my script which is not working. Any ideas to make it work??

  1.             rules: {
  2.                 "addressName": {
  3.                     required: true,
  4.                     noSpace: true,
  5.                     
  6.                     remote: {
  7.                    url: "https://localhost:8443/mysite/myaccount/addresses/isExistingAddressName",
  8.                    contentType: "application/json; charset=utf-8",
  9. data: {
  10. customerAddressId : function() {
  11. var isAdd = $('#customerAddressForm').prop("action").split("/").pop();
  12. if (isAdd == "Shipping") {
  13. return $("#customerAddressForm").prop("action").split("/").pop();
  14. } else {
  15. return $("-10");
  16. }
  17. }
  18. }
  19.                     }
  20.                     
  21.                 },