Simulate a JSONP response with JavaScript URLs

前端 未结 3 1055
南方客
南方客 2020-12-16 17:12

I\'m using Gravity Forms on a WP site. My forms POST via ajax to Pardot using Pardot form handlers. I am running into an issue where Pardot processes the form 6x, with no ot

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 17:33

    What Pardot is suggesting is to create 2 static URLs on your own server that return a simple JSON response.

    So for example:

    1. mysite.com/pardot-success

    Returns: {"result":"success"}

    1. mysite.com/pardot-error

    Returns: {"result":"error"}

    You'll then use those two URLs as your success and error redirect URLs for your Pardot form handler settings.

    An AJAX request can then be made to your Pardot form handler using JSONP, which will wrap and return the JSON response from one of those URLs (depending on the result).

    Your AJAX response data would include your JSON result (success or error).

提交回复
热议问题