setAttribute to an xml creation delivery

Avatar

Avatar

maurizio_coro

Avatar

maurizio_coro

maurizio_coro

11-10-2018

Hello, I'm creating a delivery via JS and I'm trying to add an attribute dynamically to this code:

var xmlTargeting =

      <delivery>

        <targets>

          <deliveryTarget/>

        </targets>

        <variables/>

        <scheduling/>

      </delivery>;

I've tryed     xmlTargeting.targets.setAttribute("addProofInTarget","true");

but I got an error: xmlTargeting.targets.setAttribute is not a function.

Any idea on the right code?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

MarcelSzimonisz

MVP

Avatar

MarcelSzimonisz

MVP

MarcelSzimonisz
MVP

12-10-2018

Try to use  .add() method from jsapi

eg.

var proof = xmlTargeting.targets.deliveryTarget.add(<addProofingTarget/>) ;

proof.anyAttribute = something;

...

...

Answers (0)