Note that there are some explanatory texts on larger screens.

plurals
  1. POremove previous JSON Data in client side and reload new Data on button click
    primarykey
    data
    text
    <p>in page load i am getting json data that`s ok but i want when i click on search button it will reload a new JSON Data according to Searching Criteria and remove previous JSON Data from client side.</p> <p>in Search Criteria there are some dropdownlist and textboxes with Search button and all the controls in Search Criteria are Server Controls (Asp.net) </p> <p>My problem is that when i click on search button it is generating a new JSON Data with Old JSON Data which i really don`t want for example in page load there is Apple but when i select Orange from DropDownlist and hit on search button it will showing both Apple and Orange, it should be only showing Orange as i was searching for only Orange not for both apple and orange..</p> <p><strong>here is my code for displaying the json Data</strong></p> <pre><code>&lt;script type="text/javascript"&gt; function StockList() { $.ajax({ type: "POST", url: "stocklist.aspx/Select_Search", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { var j = 1; var count = 9; for (var i = 0; i &lt; data.d.length; i++) { var output = '&lt;ul class="selection page-' + (i == count || (i &amp;&amp; !(i % 9)) ? j++ : j) + '"&gt;'; output += '&lt;li &gt;'; output += '&lt;table&gt;&lt;tr&gt;'; output += '&lt;td&gt;&lt;img src="http://localhost:37245/NewPeaceAuto - Steer_Well/WebStock_Images/' + data.d[i].Image1 + '" alt=""/&gt;&lt;/td&gt;'; output += '&lt;td&gt;CHASSIS NO:&lt;/td&gt;&lt;td&gt;' + data.d[i].CHASSIS_NO + '&lt;/td&gt;'; output += '&lt;td&gt;MODEL:&lt;/td&gt;&lt;td&gt;' + data.d[i].MODEL + '&lt;/td&gt;'; output += '&lt;td&gt;COLOR:&lt;/td&gt;&lt;td&gt;' + data.d[i].color + '&lt;/td&gt;'; output += '&lt;td&gt;TRANS:&lt;/td&gt;&lt;td&gt;' + data.d[i].TRANSMISSION + '&lt;/td&gt;'; output += '&lt;td&gt;DOOR:&lt;/td&gt;&lt;td&gt;' + data.d[i].DOOR + '&lt;/td&gt;'; output += '&lt;td&gt;MAKE:&lt;/td&gt;&lt;td&gt;' + data.d[i].MAKE + '&lt;/td&gt;'; output += '&lt;/tr&gt;&lt;/table&gt;&lt;/li&gt;&lt;/ul&gt;'; $("#update").append(output); count = count + 9; } } }); } &lt;/script&gt; </code></pre> <p><strong>on page Load</strong></p> <pre><code>&lt;body onload="StockList();"&gt; </code></pre> <p><strong>on page load or button click JSON Data is appending inside #update id div</strong></p> <pre><code>&lt;div id="update"&gt;&lt;/div&gt; </code></pre> <p><strong>on button click from Search Criteria by selecting a value from dropdownlist</strong></p> <pre><code> &lt;asp:DropDownList ID="ddlMake" runat="server" DataSourceID="odsMake" DataTextField="make" DataValueField="makeID"&gt; &lt;/asp:DropDownList&gt; &lt;asp:Button ID="Button2" runat="server" Text="Button" OnClientClick="StockList(); return false;"/&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload