大家好抱歉,如果我的问题似乎很疲惫。
这是我的问题。
有一个简单的搜索栏,可以将匹配记录列表作为ajax返回,即个人详细信息。
带保存记录的有一个名为“view more”的字段,用于显示来自database的特定字段的完整数据库信息。我在我的ancher标签上使用GET来使用id值来获得结果。要有一个明确的想法,请检查我的网址website url使用搜索栏上的dehra获取结果(因为数据库只有信息)。
所以我的问题是如何使用视图更多链接作为ajax请求来获得结果。
答案 0 :(得分:0)
您需要进行ajax调用并按ID显示详细信息。一种方法就是这个
<!--Add a class like 'readmore' -->
<a class="readmore" href="./display.php?data1=1">VIEW</a>
and add a div with `result` class at
<div class="result"></div> <!-- Full view will be showing here -->
现在在JS
$('.readmore').on('click', function(e){
e.preventDefault();
//Store the href
var linkVal = $(this).attr('href');
//Make an ajax get request
$.get( linkVal, function( data ) {
// create some container where you will display the full details
$( ".result" ).html( data );
});
});
就是这样,希望它有所帮助,并指出你正确的方向