Это пример для OP, это может или не может быть лучшим способом, но это будет работать:
Таким образом, на левой панели есть кнопки или ссылки, если текста вашей кнопки / ссылки достаточно для получения соответствующих данных с сервера, просто передайте их на сервер через Ajax
, иначе, если вы хотите использовать идентификаторы или какой-то уникальный идентификатор, вы можете добавить это к свойству id ваших кнопок / ссылок, а затем передать его на сервер, я позволю вам решить, какой вы хотите использовать:
//Example HTML
<div id="panelLeft">
<button id="btnOne" class="btnInfo">Info on Cats</button>
<br/>
<button id="btnTwo" class="btnInfo">Info on Dogs</button>
</div>
//Assuming you are using JQuery
//Either in your page add a script tag with this code, or add a script file
//to your project and import it into your page (View)
$(function(){
//Add click events to all your buttons by using the common className btnInfo
$('.btnInfo').on('click', function(){
const serverSideData = $(this).text(); //If you are using the text
//of the button to find the info server side
$.ajax({
url: "yourUrlToServerSideMethod",
type: "POST",
data: { yourServerSideParameter: serverSideData },
success: function(data){
//Successfully posted to server and got response
//If data is in JSON format, you can parse it with JSON.parse()
//Clear your div on the right which displays the item data
$('#divRightPanelInfo).html('');
$('#divRightPanelInfo).append(data); //If this is just a string
//Or create some pretty element(s) and append that to div
},
error: function(jqXHR, exception){
//Handle error, show error label or something
}
});
});
});