InsertRecords with jquery erorr

InsertRecords with jquery erorr

Hi,

I'm trying to call the InsertRecords api with jquery ajax method and I'm getting a 500 internal error message. Does anyone have any suggestions? Here is the code:

  1. var leadCRMUrl = 'https://crm.zoho.com/crm/private/xml/Leads/insertRecords?'; //api service
  2. var crmForm = $('#crmForm').serializeArray();

  3. var crmAcctData = 'newFormat="1"&authtoken=<TOKEN>&scope=crmapi&xmlData='
  4. crmAcctData +=
  5. '<?xml version="1.0" encoding="utf-8"?> \
  6. <Contacts> \
  7. <row no=1> \
  8. <FL val="First Name">' + crmForm[0].value + '</FL> \
  9. <FL val="Last Name">' + crmForm[1].value + '</FL> \
  10. <FL val="Email">' + crmForm[2].value + '</FL> \
  11. <FL val="Department">test</FL> \
  12. <FL val="Phone">9999999999</FL> \
  13. <FL val="Fax">9999999999</FL> \
  14. <FL val="Mobile">9999999999</FL> \
  15. <FL val="Assistant">Test</FL>\
  16. </row> \
  17. </Contacts>';
  18. $.ajax({
  19. type: 'POST',
  20. url: leadCRMUrl,
  21. data: crmAcctData,
  22. dataType: "xml",
  23. });