以下のコードで何が間違っているのかわかりません。このフォーラムで見つけることができるほとんどすべてを試しましたが、成功しませんでした。H3タグ内の「a href」の値を取得しようとしています。
HTML
<div class="product" style="opacity: 1;">
<a title="product" href="url-to-product.com">..................</a>
<h3><a href="url-to-product.com">Blabla</a></h3>
</div>
<div class="product" style="opacity: 1;">
<a title="product" href="other-url-to-product.com">..................</a>
<h3><a href="other-url-to-product.com">Blabla</a></h3>
</div>
h3 タグ内の href から値を取得し、getJSON 関数で使用する変数にする必要があります。私は、最も近い、兄弟、そして次のようなことを試しました:
$( ".opener" ).live("click", function(event) {
event.preventDefault();
$.get($(this).attr('href'), function(data, status) {
$( "#dialog" ).dialog( "open" );
**var url = $('.product h3 > a').attr('href')+'?format=json';**
$.getJSON(url, function(data) {
「未定義」エラーが常に発生します。何が間違っているのかわかりません。