A
A
aliasst2019-06-06 15:32:26
JavaScript
aliasst, 2019-06-06 15:32:26

How to connect a form on a website via api with a callback service?

Tell me, there is a simple form on the site (the application goes to the post office), there is a Callbackhunter callback widget. It is necessary that when sending a number in this simple form, there is a connection with the manager, as in the Callbackhunter widget.
There is an API function for connecting this simple form with a callback service.. in the parameter of which the client number is passed. Here it is - CBHCore.api.sendCall({phone: '+71234567898' }).
Where to insert this function? in the script that binds the form to the php handler?
Those. more or less like this:

$(".form").submit(function(){
        CBHCore.api.sendCall({phone: 'номер клиента' })
    
    var data = $(this).serialize();
      $.ajax({ 
         type: 'POST',
         url: 'send.php',
         data: data, 
           success: function(data){ 
             }        
           });
  });
});

Correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question