Best Performance + jQuery Ajax + Div Refresh

后端 未结 4 2058
甜味超标
甜味超标 2021-01-16 13:50

Does anyone have good suggestion of the best option for jQuery Ajax to refresh a DIV?

Following are what I\'m trying to achieve:

  1. Optimization of perfor
4条回答
  •  我在风中等你
    2021-01-16 14:42

    Use different methods on the server that generate each section of content. That way you can simply call that method to get that specific content rather than calling a generic method and extracting just the content you need. Once you have distinct methods to get each content item, you can use the href to that method as the link and use the jQuery load method to retrieve the content via AJAX and update the content area.

    The following example assumes each of your navigation links has the class nav-link and that the content area has id content. It also assumes that you've included jQuery.js.

     
    
    ... initial content...

提交回复
热议问题