Advertisement
jsaldanav

integraciones.js

Aug 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. function conectarWoo() {
  2.  
  3.  
  4.  
  5. var url = $("#txtURLtiendaWoo").val();
  6. var apiKey = $("#txtAPIkey").val();
  7. var apiKeySecret = $("#txtAPIkeysecret").val();
  8. //var version = $("#cboVersion").val();
  9. var cboDireccion = $("#cboDirecciones").val();
  10.  
  11.  
  12. if (url == "") {
  13. alert("Ingresa Url de la tienda");
  14. return false
  15. }
  16. else if (apiKey == "") {
  17.  
  18. alert("Ingresa Api key");
  19. return false
  20.  
  21. }
  22.  
  23. else if (apiKeySecret == "") {
  24.  
  25. alert("Ingresa Api secret key");
  26. return false
  27.  
  28. }
  29. else if (cboDireccion == "") {
  30.  
  31. alert("Seleccion Dirección");
  32. return false
  33.  
  34. }
  35.  
  36.  
  37. var registros, Error = '';
  38. var urlFetch = "http://emissarywebservice.site?url=" + url + "&consumer_key=" + apiKey + "&consumer_secret=" + apiKeySecret;
  39. var pJData = [];
  40. pJData.push({
  41. url: url,
  42. apiKey: apiKey,
  43. apiKeySecret: apiKeySecret,
  44. nombreRemitente: nombreRemitente,
  45. correoRemitente: correoRemitente,
  46. telefonoRemitente: telefonoRemitente,
  47. direccionRemitente: direccionRemitente,
  48. referenciaRemitente: referenciaRemitente,
  49. coloniaRemitente: coloniaRemitente,
  50. codigoPostalRemitente: codigoPostalRemitente,
  51. estadoRemitente: estadoRemitente,
  52. cboDireccion: cboDireccion,
  53. urlFetch: urlFetch
  54. });
  55. console.log(pJData);
  56. pJData = JSON.stringify(pJData);
  57. $.ajax({
  58. type: "POST",
  59. url: "listadoEnvios.aspx/conectarWoo",
  60. data: JSON.stringify({ pJData: pJData }),
  61. async: false,
  62. cache: false,
  63. contentType: "application/json; charset=utf-8",
  64. dataType: "json",
  65. success: function (result) {
  66. alert("Cuenta sincronizada")
  67. },
  68. error: function (result) {
  69. alert("No hay Órdenes por guardar")
  70. }
  71. });
  72.  
  73. // alert("Cuenta sincronizada");
  74.  
  75. //}).catch(function (err) {
  76. // console.log(err);
  77. //});
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement