3

Now i am using construction like this

$.post(
    location.href,
    {
        adverts: []
    },
    function (html) {
        $.fancybox({
            'content': html,
            'type': 'html',
            'padding': 0
        });
    }
);

And everything works fine, if html is only html, but if i add javascript to html,

<script type="text/javascript">

    alert('text');

</script>

attempt to open fancybox is crashing with Uncaught SyntaxError: Unexpected end of input

Please notice, in my case i can't use 'href' instead of 'content' for fancybox.

Update

<script>

    alert('');

</script>

Fixed the problem, just removed type="text/javascript" part :)

Update:

Any type of quotes breaking fancybox opening ;)

Itsmeromka
  • 3,621
  • 9
  • 46
  • 79
  • 1
    I guess it should be a problem with the parse of fancybox, good to know it :) – Manjar Mar 25 '15 at 08:20
  • 2
    I think this is more ajax content than inline content. Here there are some interesting reading when inserting scripts via ajax http://stackoverflow.com/q/4619668/1055987 and http://stackoverflow.com/q/1197575/1055987 – JFK Mar 25 '15 at 16:49
  • 1
    If you have solved your problem, I think you should answer your own question (and accept the answer) so that it is not shown among "unanswered". – YakovL Apr 25 '16 at 11:28

1 Answers1

0
<script>
    alert('');
</script>

Fixed the problem, just removed type="text/javascript" part.

Update:

Any type of quotes breaking fancybox opening.

Itsmeromka
  • 3,621
  • 9
  • 46
  • 79