M
M
Maxim Timofeev2016-02-03 13:36:16
JavaScript
Maxim Timofeev, 2016-02-03 13:36:16

How to escape slashes in js?

There is a php code that generates a js script:

<?php
 $this->registerJs("
                $('#ajax-image').on('shown.bs.modal', function () {
                  $.get('/image-manager/ajax-create?modul_name=\common\models\Portfolio&modul_item_id=".$model->id."',function(data){
                  неважно
                  });
                });
");?>

Actually, you need to pass a namespace, for example \common\models\Portfolio
If I write like this \common\models\Portfolio or like this \\common\\models\\Portfolio - I get commonmodelsPortfolio in the url It's
stuck tightly. Need help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tvolf, 2016-02-03
@webinar

Try adding more slashes. For example, 4 backslashes in a row. The matter is that at you the line is quoted twice (one line is nested in another).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question