There are many examples of using AJAX to implement floor loading, but most of the HTML code is manually stitched, inconvenient to write, and difficult to maintain.
The following is the use of ajax+partialview to achieve
1.html Code
class="floor" id="floor1"> class ="floor" id="floor2"> < /div><!--Floor 2 End--
2.js Code
<script type="Text/javascript">varSuccessload =NewArray ();//Loaded Floors//scroll bar scrolling$ (window). Scroll (function () {scrollload ();}); //scroll bar scrolling Eventsfunction Scrollload () {varScrollTop = $ ( This). scrolltop (); //load new content when content is scrolled to the bottom$(". Floor"). Each (function (index, value) {if(ScrollTop + $ (window). Height () >= $ ( This). Offset (). Top && $ ( This). Offset (). Top + $ ( This). Height () >=scrolltop) { if($.inarray (Index +1, successload) = =-1) {Loadfloor (index+1); Successload.push (Index+1); } } }); } //Floor Merchandise Bindingfunction Loadfloor (loadindex) {if(Loadindex = =1) {$.ajax ({URL: $ ("#GetProductsUrl"). Val (), type:"POST", DataType:"HTML",//format is HTMLsuccess:function (data) {$ ("#floor1"). HTML (data); }, Error:function (msg) {alert ("Error:"+msg.responsetext); } }); } if(Loadindex = =2) {$.ajax ({URL: $ ("#GetProductsUrl"). Val (), type:"POST", DataType:"HTML",//format is HTMLsuccess:function (data) {$ ("#floor2"). HTML (data); }, Error:function (msg) {alert ("Error:"+msg.responsetext); } }); } }</script>
3. Controller
[HttpPost] Public return partialview ("Products");}
4.PartialView page
@{ null;} <p>welcome</p>
"MVC" Ajax+partialview to implement the floor loading of the Mall home page