这是我想从 fetch.php 中获取值的索引文件。 $('#loader').html($(response).fadeIn('slow'));
这允许获取所有值并将其显示在 div = loader 中。但我想将单个返回值存储到 javascript 值中。
$.post("fetch.php?url="+$('#url').val(), {}, function(response){
//var $res=$(response);
//var title =$res.filter('.title').text(); (not wrking)
//$('#title').val(title);
$('#loader').html($(response).fadeIn('slow'));
$('.images img').hide();
$('#load').hide();
$('img#1').fadeIn();
$('#cur_image').val(1);
});
});
<input type="hidden" name="cur_image" id="cur_image" />
<div id="loader">
<div align="center" id="load" style="display:none"><img src="load.gif" /></div>
</div>
<input type="hidden" name="title" id="title" />
(e.g. I want to store the title value from fetch.php to this hidden field)
**fetch.php**
<div class="info">
<label class="title">
<?php echo @$url_title[0]; ?>
</label>
<br clear="all" />
<label class="url">
<?php echo substr($url ,0,35); ?>
</label>
<br clear="all" /><br clear="all" />
<label class="desc">
<?php echo @$tags['description']; ?>
</label>
<br clear="all" /><br clear="all" />
<label style="float:left"><img src="prev.png" id="prev" alt="" /><img src="next.png" id="next" alt="" /></label>
<label class="totalimg">
Total <?php echo $k?> images
</label>
<br clear="all" />
</div>