Links on the page are displayed I have this php code
<?php foreach ($ids as $itemIds): ?>Click the link 1
Click the link 2
Click on the link 3<?php endforeach; ?>
In the array
$ids the identifiers which are previously taken from the database. Such identifiers at different periods of time may be a different number.
These identifiers form the parameters for each link. It all works well. But we need this whole thing translated into ajax.
So, if for example, I clicked on the link
id="url-1" the response from the server is displayed inside the tag
And so on each link on the page.
=================================================================================
Now go to ajax. I have this code for ajax based on jquery.
function funcBefore(){$("#info-1").text("Ожидание данных");}function funcSuccess(data){$("#info-1").text(data);}$(document).ready(function(){$("#url-1").on("click", function(){$.ajax({url: "myscript.php",type: "GET",dataType: "html",beforeSend: funcBefore,success: funcSuccess});});});
With the help of it I can handle, I need the elements on the page. But the problem is, how do I handle dynamic links on the page, which can be a different number? And with different parameters for GET request. That is, as I pointed out in the example above.
All I would be very grateful for the help!