私はonclick関数を書いたという点で、hrefタグを持っています。
<a href="#" id="thumb" class="thumb" onclick="doThumb('<?php echo the_ID(); ?>');"><?php the_post_thumbnail('portfolio_thumbs'); ?></a>
onclick() 関数のコードは、
<script type="text/javascript">
function doThumb(temp)
var tempThmb = temp;
document.getElementById("selectedResult").innerHTML=tempThmb;
return tempThmb;
}
</script>
戻り値、空の div に出力します。
<div id="selectedResult" name="selectedResult"></div>';
今私の問題は、空の div で結果を取得することですが、div の値を $my_postid に渡す必要があります。
$my_postid = "Should pass the value here";//This is page id or post id
$content_post = get_post($my_postid);
どうすればこれを達成できますか? ajax jqueryを使用する必要がありますか?親切に助けてください....