I want to have something like a small search engine for the FAQ section on my website. All it does is search the SLQ_DB for the term upon pressing a button.
I want to output the question and the answers in two seperate divs. Therefore I have $data and $data1 which belong to the divs.
$('input#name-submit').on('click',function()
{
var name = $('input#name').val();
//alert(name);
if($.trim(name) != "")
{
$.post('ajax/name.php',{name:name},function(data, data1)
{
$('div#name-data').html(data);
alert(answer);
$('div#name-data1').html(data1);
});
}
});
But when I hit enter the second div shows "success". But the first one has data and data1 in it. When I write function(data1, data) in the js file, the data1 has all the information, and data is just "success".
What's happening here?