How to Run ajax when Web hook returns the response

New Member
1 0 0

Hello Everyone


I'm using Shopify customers/create webhook to get the registered customer data and I want to store all customer detail to my localhost database
I have created the Private app in PHP from  GitHub link  and it is working fine I am using ngrok for webhook https URL and I'm getting the response in JSON format to store in my database I have used the ajax when I check the response of Webhook it returns the value in my ajax script but executing the ajax script, I want to confirm how we can execute the ajax script as webhook send a response 
My file code is given below

$info = file_get_contents('php://input');
$data = json_decode($info, true);
$first_name = $data['first_name'];
$last_name = $data['last_name'];
$email = $data['email'];
$password = '123456789';

#As ajax should be run after webhook response will trigger so click, load etc.. event will not work for ajax 
async: true,
type: "POST",
url: "insert.php",
data: {
'first_name' : <?php echo first_name;?>,
'last_name' : <?php echo last_name;?>,
'email' : <?php echo email;?>,
'password' : '123456789',
success: function(res) {


Any help would be appreciated, also is there any way how we get the password from Shopify customers using webhook