Support » Plugin: Brilliant Web-to-Lead for Salesforce » AJAX Submission?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Nick Ciske


    You could short circuit the form submit with jQuery and submit the data to the Salesforce API yourself via ajax (without touching the core plugin), but it would require some decent coding chops to pull off.

    Yeah, I thought about that but couldn’t think of a way to do it without exposing the Organization’s ID and still be able to work with the plug-in’s settings.

    Thanks anyway, Nick.

    Plugin Author Nick Ciske


    You could call your own AJAX function in WordPress and access that data from the WP options.

    It’s a workaround, but if you sent me the code, I may be able to adapt it into a future version.

    Or, feel free to fork it on GitHub and submit a pull request with Ajax baked in 😉

    I’ve solved this with a simple jQuery POST function:

      var email = $(this).find('#sf_email');
          // These are the fields you are sending
          email: email.val(),
          // Note: these fields are required to validate for Salesforce
          message: '',
        function(data, status, jqXHR){
          // Do something to notify user data has been sent
          console.log(status + ' with status code: ' + jqXHR.status);
        console.log('Oh no! We have failed you.');
      // Stop page from refreshing
      return false;

    Edit: The only problem I’ve found with this is that is always returns “success” so you will have to validate the form on the client-side before sending. If you want, I could set up a pull request to add type="email" instead of having emails as plain text because SF won’t throw errors.

    Plugin Author Nick Ciske


    Yeah, the Web 2 Lead API is weird like that — if I remember right it returns an HTTP header/code instead of a message in the body (you can view the plugin code to see how it’s handled there).

    How are you passing the organization ID here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘AJAX Submission?’ is closed to new replies.