1
I’m wanting that when I open the "#portfolioModal54" and run the ajax add in front of the url the name and id of the clicked block.
Example:
BLOCK 1: #portfolioModal54 opened with the $name = quad so the url will be: site.com.br/index.php#quad01
BLOCK 2:#portfolioModal54 opened with the $name = Circ so the url will be: site.com.br/index.php#circ02
Here on this site you can see the blocks and the ajax working: I just want to add $name and $id in front of url when clickado. somospixel.com/portfolio.php
Here is the Block that will open #portfolioModal54 that has the value "Executes ajax" and takes variables with database information.
<div class="element-item third-effect todos <?php echo "$menu";?>" data-category="transition">
<a href="#portfolioModal54" class="portfolio-link" data-toggle="modal" onclick="portfolioModal(<?php echo $id;?>)" value="Executa ajax">
<img src="<?php echo "$imageM"?>" alt="imagem">
<div class="mask"> <div class="conteudo_mask" style="transform: translateY(-50%);top: 50%;position: relative;">
<h1><?php echo "$nome"?></h1><div id="lin" style="width: 110px;"></div><h2><?php echo "$tipo"?></h2></div><h3 style="transform: translateY(-50%);top: 50%;position: relative;
">VEJA <br><img src="images/mais.png" alt="mais" style="width: 20px;height: 19px;margin-bottom: -1px;margin-top: 12px;margin-left:0px;"></h3>
</div>
</a>
</div>
<?php
}
?>
Here is the Modal54 that is opened and inside it receives a "Receive Jax"
<div class="portfolio-modal modal fade" id="portfolioModal54" tabindex="-1" role="dialog" aria-hidden="true">
<div id="barra-sty">
<div class="wrap">
<div id="logo" style="width: 50px; height: 50px; float: left;">
<img src="images/logom.png">
</div></div>
<div class="close-modal" data-dismiss="modal">
<div class="lr">
<div class="rl">
</div>
</div>
</div></div>
<div class="wrap RecebeAjax">
</div>
</div>
Here the ajax.js
function portfolioModal(id){
$(".RecebeAjax").load("ajax.php?id="+id);
}
I was able to get him to just take the ID, but I want him to take the name tbm, but I feel like I’m putting something wrong and so it won’t. Function portfolioModal(id){ $(".Receivajax"). load("ajax.php?id="+id); history.pushState(', '', window.location.href.split('#')[0]+ '#' +id); } E HERE ONCLICK onclick="portfolioModal(<?php echo $id;?>)" value="Executes ajax">
– kaiquemix
Keeps appearing the ID and where should ta the name appears Undefined and ajax.php information is waiting for a boolean parameter.
– kaiquemix
Look carefully at the principle of the answer... I put the functional example below
– Miguel
yes I’m looking at the JS
– kaiquemix
Inside onclick put what I put, and make sure that there is the
$name
and the$id
, see the source code of the page to see if it is... right click on the source code– Miguel
Yes EXISTS $id = $sql["id"]; $name = $sql["name"]; I put <?php echo $id. $name;? > ae does not appear either the link or where pulls from the ajax, but if you only have the ID it pulls things.
– kaiquemix
you must also change the function of js, are entering 2 arguments, name and id now. see the source code of the page to see if inside the function
onclick
is right. Also change the ajax function. Try opening a.php file with what I’ve put down to try it out– Miguel
I have to go to dinner (I’m from Portugal :P) later or tomorrow I see. If you continue the problem say we solved tomorrow @kaiquemix
– Miguel
Thank you very much friend :D
– kaiquemix
Did you make it? @kaiquemix
– Miguel