D
D
DenKG2016-12-11 15:46:41
JavaScript
DenKG, 2016-12-11 15:46:41

How to display data on the page for each transaction when clicked?

On the left, I have a field where all transactions are displayed. And now, by clicking on them, more detailed information about it should be shown to me on the right. Well, simply put, as on webmoney: on the left is the operation, on the right is its full information.
Here is the script for the left column:

<script>
    function simple_tooltip(target_items, name){
  $(target_items).each(function(i){
  $("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
  var my_tooltip = $("#"+name+i);

  $(this).removeAttr("title").mouseover(function(){
  my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
  }).mousemove(function(kmouse){
  my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
  }).mouseout(function(){
  my_tooltip.fadeOut(400);
  });
  });
  }
  $(document).ready(function(){
  simple_tooltip("a","tooltip");
  });
  </script>


Well, the code itself.
@foreach ($transactions as $transaction)
<a href="?id={{$transaction->trans_id}}" title="Сумма: {{$transaction->trans_pay_sum}}">
<div class="summa in" id="trans_id" value="{{$transaction->trans_pay_sum}}">{{$transaction->trans_pay_sum}}</div>
<div class="descr" id="trans_id" value="{{$transaction->trans_pay_appoint}}">{{$transaction->trans_pay_appoint}}</div>
</a>
@endforeach


But now how can I get the necessary information into the right column? I won't put my mind to it. At least give a link where to read

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-12-12
@hummingbird

I will not look at this code, laziness. Plus, it's horribly formatted. Think about the people who help you for free. OK. I'll just describe how I would do it.
The point is this. As I understand it, you have a column on the left with a list of all transactions. By clicking on a transaction, you want to display all the information about the transaction in the right column.
I would do it all with AJAX. That is, on the right you have a block:
Where all the information will be placed.
Now you need to somehow place information in this block. Imagine that the left block is a stupid link. Add an attribute to the link:
Well, everything is clear here. Now you need to write a function that will make an AJAX request and, if successful, will place the information in the desired block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question