K
K
Kornely2021-03-16 21:40:54
AJAX
Kornely, 2021-03-16 21:40:54

How to connect a page by load, passing part of the parent url to it at the same time?

Let's say the page https://site.ru/index.php?option=page&id=900 has the following code:
<span id="aaa">Нажать</span><div id="bbb"></div>

$(document).ready(function(){$("#aaa").click(function(){$("#bbb").load("ccc.php")})});

How to transfer part of the "parent" url after clicking on the included ccc.php file?

I put the code on ccc.php But it shows ccc.php . And you need index.php?option=page&id=900 require('ccc.php'); and do not offer the rest through php - you need a dynamic connection on click. echo $_SERVER['REQUEST_URI'];


Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MagicMight, 2021-03-16
@MagicMight

$(document).ready(function(){$("#aaa").click(function(){$("#bbb").load("ccc.php?path=" + window.location.pathname)})});

does not work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question