post customer details using jquery ajax call

post customer details using jquery ajax call

Hi,


I am unable to save customer details in zoho DB. I'm getting error.below i have attached. please help me out to overcome from this problem.




By using below mentioned script ,communicate with DB

<script>
        $(document).ready(function () {
            $('#btnRegister').click(function () {
            debugger
               SaveCustomer();           
            });

            });



            function SaveCustomer() {
                var CustomerData = {
                    display_name: "Bowman Furniture",
                    first_name: "Benjamin",
                    last_name: "George",
                    email: " benjamin.george@bowmanfurniture.com",
                    company_name: "Bowman Furniture",
                    phone: "23467278",
                    mobile: "938237475",
                    website: "www.bowmanfurniture.com",
                    billing_address: {
                        street: "Harrington Bay Street",
                        city: "Salt Lake City",
                        state: "CA",
                        zip: "92612",
                        country: "U.S.A",
                        fax: "4527389"
                    },
                    shipping_address: {
                        street: "Micheal Street",
                        city: "Austin",
                        state: "Texas",
                        zip: "75211",
                        country: "U.S.A",
                        fax: "4527389"
                    },
                    currency_code: "USD",
                    ach_supported: true,
                    notes: "Bowman Furniture",
                    custom_fields: [
        {
            "index": 1,
            "value": "129890"
        },
        {
            "index": 2,
            "value": "Premium"
        }
    ]
                };

                $.ajax({
                    type: "POST",
                    url: " https://subscriptions.zoho.com/api/v1/customers",
                    headers: { 'X-com-zoho-subscriptions-organizationid': 'xxxxxxxxx',
                        'Authorization': 'Zoho-authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
                    },                  
                    data: JSON.stringify(CustomerData),
                    contentType: "application/json; charset=utf-8",
                    dataType: "jsonp",
                    processData: true,
                    crossDomain: true,
                    success: function (data, status, jqXHR) {
                        alert("success..." + data.message);
                    },
                    error: ServiceFailed
                });

            }

            function ServiceFailed(result) {

                alert('Service call failed: ' + result.status + '' + result.statusText);

                Type = null; Url = null; Data = null; ContentType = null; DataType = null; ProcessData = null;

            }
       
    </script>