How to check for existing .class in a response text in jquery
<p>I have got below JQuery where I am performing the .load function.</p>

<pre><code>$(".load-fragment").each(function()         
        {          
            var $objThis = $(this);
            var fname = $objThis.attr("href"); //Getting the href of the element
            var dynDivID = "divContent"+ $objThis.attr("id");  //Name of the dynamic div ID
            var newDiv = $("&lt;div&gt;").attr("id",dynDivID)
            .load(fname+ " #tab-container", {pupdate:"true"},function(response, status, xhr) 
            {
                if ( $(response+".formContainer").length) 
                {
                    $objThis.removeClass('load-fragment');                                                    
                }     
                if (status == "error") 
                {               
                    newDiv.removeClass('dynDiv');
                    newDiv.addClass('errorDiv');
                }
            })//Loading page fragment from the given link
            .hide()//Hiding all the newly created DIVs
            .addClass('dynDiv')//Adding CSS to newly created Dynamic Divs
            .append($('&lt;img/&gt;').attr({ src: '/system/Images/ajax-loader-circle-thickbox.gif', alt: '', style:'margin:50px 0px 50px 185px' }));//Adding the loading.gif file
            $("#container-4").append(newDiv);//adding new div in div column2
        }); 
</code></pre>

<p>In a <strong>.load</strong> function above, I am trying to load page fragment from the linked page. I am getting the response in a below html format.</p>

<pre><code>&lt;div class="tabs-container" id="tab-container"&gt;
    &lt;div class="contentContainer"&gt;
        &lt;div class="contentContainer"&gt;
            &lt;p&gt;
                Book your New Delhi flights with Emirates and experience our award-winning service
                flying direct to Australia's most iconic city.&lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="formContainer"&gt;
        &lt;p&gt;Testing&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now I want to check in response text whether there <strong>formContainer</strong> class exists inside the response or not and then perform certain work. Below is the code I am trying but it is not working for me.</p>

<pre><code> .load(fname+ " #tab-container", {pupdate:"true"},function(response, status, xhr) 
                {
                    if ( $(response+".formContainer").length) 
                    {
                        $objThis.removeClass('load-fragment');                                                    
                    }     
                    if (status == "error") 
                    {               
                        newDiv.removeClass('dynDiv');
                        newDiv.addClass('errorDiv');
                    }
                })
</code></pre>

<p>Please suggest!</p>
