Refresh part of an HTML page using jquery

Is there a way to refresh or set as default only part of the HTML (instead of reloading the whole) page with jquery? For example, I want to reset the next select on some click actions. Please help. Thank you very much in advance.

....
<select id="refresh">
   <option value="1" selected>1</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
</selected>
......
+3
source share
1 answer

I assume you mean using AJAX. The easiest way is to use .load. http://api.jquery.com/load/ . Code will be

$("#refresh").load("page/to/load/content.html #content")

Loads content on the page content.html with the identifier "content" into the update element.

Of course, you can use the server page to create content, for example, on a php or ASP.NET page.

+5
source

Source: https://habr.com/ru/post/1758106/


All Articles