<script> tag is shown in ajax response and executed?
<p>now i got this issue actually i don't know why, this is the first time that i faced this issue. </p>

<p>let me explain it to you </p>

<ul>
<li>i have ajax request. </li>
<li>the response of this ajax request will be shown in a div.</li>
<li>the response is a page contain html, php, js.</li>
<li>the script is running but the script tag is returned as text.</li>
</ul>

<p>okay let me explain the problem to you. </p>

<blockquote>
  <p>The response has <code>&lt;script&gt;</code> but when i called the ajax request the <code>&lt;script&gt;</code> shown in the result as text !!!</p>
</blockquote>

<p>let me show u my code</p>

<p><strong>AJAX REQUEST</strong></p>

<pre><code>$.ajax({
    url: getBaseUrl() + 'Pages/book_room',
    async: false,
    data: {offerKey: offerKey, roomType: roomType, hotel: hotel, address: address, stars: stars, checkIn: checkIn, checkOut: checkOut, people: people, image: image, price: price, currency: currency, roomCount: roomCount},
    type: 'post',
    dataType: 'html',
    beforeSend: function() { 
        $('#' + offerKey).show('slow'); 

    },
    success: function(data) {
        console.log(data);
        $('#' + offerKey).hide('slow', function() {
            $.parseHTML(data, document, true);
            $(this).html(data);
        });
    },
    complete: function() {
        $('#' + offerKey).show('slow');
    }
});
</code></pre>

<p><strong>THE RESULT</strong>
<a href="https://i.stack.imgur.com/HwdUx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HwdUx.png" alt="This is my status ???!!! why this happening"></a></p>

<p><strong>UPDATE AJAX TARGET CONTENT</strong></p>

<pre><code>&lt;section id="content" style="background: #fff;"&gt;
    &lt;div class="container" style="width: 100%;"&gt;
        &lt;div class="row"&gt;
            &lt;div id="main" class="col-xs-12 col-sm-12 col-md-12"&gt;
                &lt;div class="booking-section travelo-box"&gt;
                    &lt;div class="stepwizard col-md-offset-3"&gt;
                        &lt;div class="stepwizard-row setup-panel"&gt;
                            &lt;div class="stepwizard-step"&gt;
                                &lt;a href="#step-1" type="button" class="btn btn-primary btn-circle"&gt;1&lt;/a&gt;
                                &lt;p&gt;Personal Information&lt;/p&gt;
                            &lt;/div&gt;
                            &lt;div class="stepwizard-step"&gt;
                                &lt;a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled"&gt;2&lt;/a&gt;
                                &lt;p&gt;Payment Option&lt;/p&gt;
                            &lt;/div&gt;
                            &lt;div class="stepwizard-step"&gt;
                                &lt;a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled"&gt;3&lt;/a&gt;
                                &lt;p&gt;Confimation&lt;/p&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;form id="room_book" class="booking-form" method="POST"&gt;
                        &lt;div class="row setup-content" id="step-1"&gt;
                            &lt;div class="person-information"&gt;
                                &lt;h2&gt;Your Personal Information&lt;/h2&gt;
                                &lt;div class="form-group row"&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;first name&lt;/label&gt;
                                        &lt;?php
                                            $attr = array(
                                                'type' =&gt; "text",
                                                'class' =&gt; "input-text full-width",
                                                'value' =&gt; set_value('first_name'),
                                                'name' =&gt; 'first_name',
                                                'id' =&gt; 'first_name'
                                            );
                                            echo form_input($attr); 
                                        ?&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;last name&lt;/label&gt;
                                        &lt;?php
                                            $attr = array(
                                                'type' =&gt; "text",
                                                'class' =&gt; "input-text full-width",
                                                'value' =&gt; set_value('last_name'),
                                                'name' =&gt; 'last_name',
                                                'id' =&gt; 'last_name'
                                            );
                                            echo form_input($attr); 
                                        ?&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;email address&lt;/label&gt;
                                        &lt;?php
                                            $attr = array(
                                                'type' =&gt; "email",
                                                'class' =&gt; "input-text full-width",
                                                'value' =&gt; set_value('email'),
                                                'name' =&gt; 'email',
                                                'id' =&gt; 'email'
                                            );
                                            echo form_input($attr); 
                                        ?&gt;

                                    &lt;/div&gt;
                                &lt;/div&gt;
                                &lt;div class="form-group row"&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Verify E-mail Address&lt;/label&gt;
                                        &lt;?php
                                            $attr = array(
                                                'type' =&gt; "email",
                                                'class' =&gt; "input-text full-width",
                                                'value' =&gt; set_value('confirm_email'),
                                                'name' =&gt; 'confirm_email',
                                                'id' =&gt; 'confirm_email'
                                            );
                                            echo form_input($attr); 
                                        ?&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Nationality&lt;/label&gt;
                                        &lt;div class="selector"&gt;
                                            &lt;input type="text" class="input-text full-width typeahead" id="autocomplete" placeholder="" /&gt;
                                            &lt;input type="hidden" id="locationId" name="locationId" /&gt;
                                        &lt;/div&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Phone number&lt;/label&gt;
                                        &lt;?php
                                            $attr = array(
                                                'type' =&gt; "text",
                                                'class' =&gt; "input-text full-width",
                                                'value' =&gt; set_value('phone'),
                                                'name' =&gt; 'phone',
                                                'id' =&gt; 'phone'
                                            );
                                            echo form_input($attr); 
                                        ?&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                                &lt;div class="form-group row"&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Date of Birth&lt;/label&gt;
                                        &lt;input type="date" name="date_of_birth" id="date_of_birth" class="input-text full-width" placeholder="yyyy-mm-dd" style="vertical-align: middle;" /&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Prefix&lt;/label&gt;
                                        &lt;select name="gender" id="gender" class="input-text full-width"&gt;
                                            &lt;option&gt;
                                                Select Prefix
                                            &lt;/option&gt;
                                            &lt;option value="Mr"&gt;
                                                Mr
                                            &lt;/option&gt;
                                            &lt;option value="Ms"&gt;
                                                Ms
                                            &lt;/option&gt;
                                            &lt;option value="Mrs"&gt;
                                                Mrs
                                            &lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-sm-6 col-md-4"&gt;
                                        &lt;label&gt;Tourest Type&lt;/label&gt;
                                        &lt;select name="type" id="type" class="input-text full-width"&gt;
                                            &lt;option&gt;
                                                Select Tourest type 
                                            &lt;/option&gt;
                                            &lt;option value="adult"&gt;
                                                Adult
                                            &lt;/option&gt;
                                            &lt;option value="child"&gt;
                                                Children
                                            &lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                                &lt;div class="form-group"&gt;
                                    &lt;div class="checkbox"&gt;
                                        &lt;label&gt;
                                            &lt;?php echo form_checkbox(array('name' =&gt; 'offersEmail'), 1, ($this-&gt;input-&gt;post('offersEmail') ? 1 : 0)); ?&gt;I want to receive &lt;span class="skin-color"&gt;Travel Lights&lt;/span&gt; promotional offers in the future
                                        &lt;/label&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                                &lt;div class="form-group"&gt;
                                    &lt;div class="checkbox"&gt;
                                        &lt;label&gt;
                                            &lt;?php echo form_checkbox(array('name' =&gt; 'agreement'), 1, ($this-&gt;input-&gt;post('offersEmail') ? 1 : 0)); ?&gt; By continuing, you agree to the &lt;a href="#"&gt;&lt;span class="skin-color"&gt;Terms and Conditions&lt;/span&gt;&lt;/a&gt;.
                                        &lt;/label&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;div style="color: red; padding: 15px;"&gt;
                                &lt;?php echo validation_errors(); ?&gt;
                            &lt;/div&gt;
                            &lt;hr /&gt;
                            &lt;div class="form-group row"&gt;
                                &lt;button class="btn btn-primary nextBtn pull-right" style="margin-right: 2%;"&gt;Next&lt;/button&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="row setup-content" id="step-2"&gt;
                            &lt;div class="col-xs-12"&gt;
                                &lt;div class="col-md-12"&gt;
                                    &lt;h2&gt;Payment Method&lt;/h2&gt;
                                    &lt;?php
                                        foreach ($payment-&gt;param-&gt;paymentMethod as $method) {
                                            ?&gt;
                                            &lt;div class="form-group"&gt;
                                                &lt;?php echo $method-&gt;description; ?&gt;
                                                &lt;label class="control-label title" style="text-transform: none;"&gt;
                                                    &lt;div style="margin: 0 15px;"&gt;&lt;input type="radio" name="paymentMethod" value="&lt;?php echo $method-&gt;id; ?&gt;" /&gt; &lt;?php echo $method-&gt;name; ?&gt;&lt;/div&gt;
                                                &lt;/label&gt;
                                            &lt;/div&gt;
                                            &lt;?php
                                        }
                                    ?&gt;
                                    &lt;div class="form-group"&gt;
                                        &lt;label class="control-label"&gt;Company Address&lt;/label&gt;
                                        &lt;input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address"  /&gt;
                                    &lt;/div&gt;
                                    &lt;button class="btn btn-primary nextBtn btn-lg pull-right" type="button" &gt;Next&lt;/button&gt;
                                &lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="row setup-content" id="step-3"&gt;
                            &lt;div class="col-xs-6 col-md-offset-3"&gt;
                                &lt;div class="col-md-12"&gt;
                                    &lt;h3&gt; Step 3&lt;/h3&gt;
                                    &lt;button class="btn btn-success btn-lg pull-right" type="submit"&gt;Submit&lt;/button&gt;
                                &lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/form&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;
&lt;script&gt;
$(document).ready(function() {
    var locationId;
    var locationName;
    $('.typeahead').typeahead({
        source: function(query, proccess) {
            $.ajax({
                url: getBaseUrl() + 'Pages/get_countries',
                data: {poi: query, order: 'POPULARITY'},
                type: 'post',
                dataType: 'json',
                success: function(data) {
                    proccess(data);
                }
            });
        },
        minLength: 3,
        updater: function(item) {
            $('#locationId').val(item.id);
            return item.name;
        }
    });
    var navListItems = $('div.setup-panel div a'),
        allWells = $('.setup-content'),
        allNextBtn = $('.nextBtn');
    allWells.hide();
    navListItems.click(function(e) {
        e.preventDefault();
        var $target = $($(this).attr('href')),
            $item = $(this);
        if (!$item.hasClass('disabled')) {
            navListItems.removeClass('btn-primary').addClass('btn-default');
            $item.addClass('btn-primary');
            allWells.hide();
            $target.show();
            $target.find('input:eq(0)').focus();
        }
    });
    allNextBtn.click(function() {
        var curStep = $(this).closest(".setup-content"),
            curStepBtn = curStep.attr("id"),
            nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),
            curInputs = curStep.find("input[type='text'],input[type='url']"),
            isValid = true;
        $(".form-group").removeClass("has-error");
        for (var i = 0; i &lt; curInputs.length; i++) {
            if (!curInputs[i].validity.valid) {
                isValid = false;
                $(curInputs[i]).closest(".form-group").addClass("has-error");
            }
        }
        if (isValid) nextStepWizard.removeAttr('disabled').trigger('click');
    });
    $('div.setup-panel div a.btn-primary').trigger('click');
});
&lt;/script&gt;
</code></pre>

<p><strong>UPDATE #2</strong></p>

<p>by the way the wizard's script is in this scrip tag and it works fine.</p>

<p><a href="https://i.stack.imgur.com/TYgWP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TYgWP.png" alt="this is the script tag in inspect element it shows that the text in script tag"></a></p>