I am using $.ajax calls in different functions however when I try to have them both it is not working. My adding function:
$('#postBtn').click(function()
{
$.ajax({
url:'process.php?q=something',
success:function()
{
alert('Successfully inserted');
}
});
});
Other function is my select again using $.ajax:
request=$.ajax({
url:'data.php?q='+query,
success:function(results)
{
if(results)
{
if(query==$('#searchbar').val())
{
$('#searchArea').addClass('searchAreaVisible');
$('#searchArea').html(results);
$('#searchArea').show();
$('#loader').hide();
runningRequest=false;
}
else
{
runningRequest=false;
}
}
else
$('#searchArea').html('ERROR!');
}
});
I really tried to find out the problem by commenting the functions however the closest I can get is that if I comment the first function second works perfectly. If I comment the second one first one works quite good as well. However if I try to use them both nothing works. I’ve tried to insert an alert just above the $(document).ready() in order to test whether it loads correctly and seen that the alert is not triggered.
Thanks in advance
Thanks for all the possible solutions, I really don’t know how but somehow I solved the problem.
@stivlo I am using it in other parts of the script.