Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Tengo un código SSJS y AJAX, ¿ahora cómo puedo juntar todo?

Tengo un código ssjs que crea una extensión de datos.

 var DE = "MyDataExtension" Platform.Load("core","1.1") var obj = { "CustomerKey" : 123, "Name" : DE, "Fields" : [ { "Name" : "Id", "FieldType" : "Number", "IsPrimaryKey" : true, "IsRequired" : true }, { "Name" : "MyData", "FieldType" : "Text", "MaxLength" : 50 }, { "Name" : "Active", "FieldType" : "Boolean", "DefaultValue" : true } ] } } }

Y descubrí que para usar este código ssjs en la función onclick debo usar AJAX, así que lo hice

 <script> function ajax() { var xmlHttp; if(window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest; } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200){ console.log(xmlHttp.responseText);}} xmlHttp.open('POST','https://...', true); xmlHttp.send()} </script>

Ahora, ¿cómo debo juntar todo?

Lo que probé ->

 <script> function ajax() { var xmlHttp; if(window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest; } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");} xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200){ console.log(xmlHttp.responseText);}} xmlHttp.open('POST','https://someone.com/LP', true);} xmlHttp.send()} </script> <script> function create(){ var DE = "MyDE" var obj = { "CustomerKey" : 123, "Name" : DE, "Fields" : [ { "Name" : "Id", "FieldType" : "Number", "IsPrimaryKey" : true, "IsRequired" : true }, { "Name" : "MyData", "FieldType" : "Text", "MaxLength" : 50 }, { "Name" : "Active", "FieldType" : "Boolean", "DefaultValue" : true } ] } }; </script> <button onclick="create();ajax()"> Request </button>

Es posible ? El código de arriba no funciona, simplemente no pasa nada.

Mi objetivo es, cuando se hace clic en un botón, se crea una extensión de datos. ¡Gracias de antemano!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!