D
D
daylight62021-03-12 13:59:40
1C-Bitrix
daylight6, 2021-03-12 13:59:40

Why is there an error in the Illegal constructor console when converting a PHP array to js?

Good afternoon.

Tell me why there is an error

in template.php

$jsParams = array(
         'ID' => '22',
);

<script>
   var item22 =
   new Element(<?=CUtil::PhpToJSObject($jsParams, false, true)?>);
</script>


In script.js
console.log(Element);

AND Illegal constructor error appears in console?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karpin, 2021-03-12
@carpin

Maybe you should start looking in js? Attach the code at least.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question