0
I’m wondering how I can do to click a button and the onclick of this button I call a php function, said I have to use ajax, but I have no knowledge in ajax but I will study, could help me?
<button id="loadmore" onclick="<?php queryRetorno($limite*2);?>">Carregar
Mais</button>
I tried this way but did not give, basically what I want is to increase the limit of sql query every time the button is clicked, here is the function queryReturn
function queryRetorno($limite){
$sql = mysql_query("SELECT DISTINCT wposts.*,(SELECT meta_value FROM
wp_7_postmeta WHERE meta_key='_wp_attached_file' and post_id = (SELECT
meta_value FROM wp_7_postmeta WHERE meta_key='_thumbnail_id' and
wp_7_postmeta.post_id= wposts.ID limit 1)) as imagem
FROM wp_7_posts wposts
LEFT JOIN wp_7_postmeta wpostmeta ON wposts.ID = wpostmeta.post_id
LEFT JOIN wp_7_term_relationships ON (wposts.ID =
wp_7_term_relationships.object_id)
LEFT JOIN wp_7_term_taxonomy ON (wp_7_term_relationships.term_taxonomy_id =
wp_7_term_taxonomy.term_taxonomy_id)
where `post_type`='post' and post_status ='publish'
LIMIT {$limite}");
carregaImagem($sql);
return $limite;
}
Just one thing, before I ask, do some research first, because this is one of the most basic scenes you have, and as you say above, you were told you needed to use ajax, you just needed to waste five minutes researching and you had your answer
– Simão Lemos
Thanks @Simão Lemos, Doubt.. In the url you have the same ** ones? and the code or php function I call in the request.done?
– Anderson Henrique
No, sry, the ** was just to bold the text, but it seems I can’t do that inside the code. I’ll fix it now
– Simão Lemos
You also don’t need to put the whole url, if the path is the same. You can just put /my path.php
– Simão Lemos
Aaah ta, @Simão Lemos but the problem you solved is another, I want to run a function like this I have the php page and run the function of this page
– Anderson Henrique
Logic is there but I’ll edit the answer...
– Simão Lemos
Already edited... more than this only if it is there your house to make....
– Simão Lemos