0

So I'm trying to call a webhook to send the value of a zip code to a webhook. I've modified code that I've found and I'm having no luck getting it to work.

<input type="text" class="street-address w-input" maxlength="256" name="Zip-Code-2" data-name="Zip Code 2" placeholder="Zip Code" id="Zip-Code-2" required=""/>
<div id="zipisright">
right
</div>
<div id="zipiswrong">
wrong
</div>

With this jquery

$(document).ready(function(){
        $('#Zip-Code-2').blur(function(){
    var zip_code = $('#Zip-Code-2').val();
       {
          $.ajax({
              url:"https://amosdigital.app.n8n.cloud/webhook-test/91383285-6a98-42cd-b9a2-6c6312f0090c",
              method:"POST",
              data:{new_base:zip_code},
              dataType:"text",
              contentType:false,
              processData:false,
              success:function(data:
              {
                $('#Zip-Code-2').val(data);
              }
           });
       }
    });
 });

nothing is actually happening when I run the code as is. I've tested it just on documentload as well, with no luck. Any help would be great. Here is a jsfiddle https://jsfiddle.net/kmonie360/fumt3xck/11/

4
  • Open the console and look at the syntax error shown Commented Nov 18, 2022 at 15:59
  • Also, I'd suggest using a better IDE if it didn't warn you about that typo. Commented Nov 18, 2022 at 16:00
  • @RoryMcCrossan console gives me a XMLhttprequest access error blocked by CORS on js fiddle. But when I test on my dev site, I get no error at all and no hit on the webhood. Commented Nov 18, 2022 at 18:47
  • Is success:function(data: just an error in the question then? Commented Nov 18, 2022 at 19:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.