Is there a limit of the size of data using replaceWIth in jQuery?
<p>I am using the <code>replaceWith()</code> function in jQuery to update my web page.  I receive the data from a C# web service program that extracts data from a database to build my HTML code.  It works fine except when I replace large amounts of data.  In the example that's not working, I replace code in my web page with 39000 bytes of data.  After that, none of my links work when clicking on a span to calls a JavaScript function.  Is there a limit on the size of data used in the <code>replaceWith()</code> function?  The html code I am replacing looks like this:</p>

<pre><code>&lt;td align=left valign=top&gt;
&lt;div id="showitems" class="showitems" style="display:inline; float:left"&gt;&lt;/div&gt;
 &lt;/td&gt;
</code></pre>

<p>The javascript code looks like this:</p>

<pre><code>function ShowDinerItems() {

            var gps = document.getElementById("selectdiner").value;
            var pos = gps.indexOf(";");
            var len = gps.length;
            var latitude = document.getElementById("Hiddenlat").value;
            var longitude = document.getElementById("Hiddenlng").value;
            var dinerkey = gps.substring(0, pos);
            PageMethods.CallShowDinerItems(dinerkey, latitude,longitude,               OnShowDinerComplete, OnShowDinerError, dinerkey);
        }

    function OnShowDinerComplete(result) {
        var htmlcode = result[0];
        if (result == 'none') {
                document.getElementById("Message").value = "Search returned no items";

            }
            else {
                var htmlcode = result[0];
                htmlcode = "&lt;div id=\"showitems\" class=\"showitems\"         style=\"display:inline\"&gt;" + htmlcode + "&lt;/div&gt;";
                $('.showitems').replaceWith(htmlcode); // size of htmlcode is 39849 bytes
                var locations = result[1].split(";");
                var lat = locations[0];
                var lng = locations[1];
                markDiner(lat, lng, "", 'map_canvas');

            }
        }
</code></pre>

<p>The reason I am using jquery to build my webpage is to avoid page reloads.  I could easily program the webdata content in my C# program which may be more efficient but page reloads are to be avoided as dictated by the people who own the website.  I am will try the recommendations given.</p>

<p>Note: I used the following code to make it work.</p>

<pre><code> $('.showitems').html(result[0]);
</code></pre>

<p>Using .text will not work as it displays raw data and not html data.  Thanks to those who contributed.</p>
