Answer the question
In order to leave comments, you need to log in
What code should be written in ajax.php?
I need to do post processing, what code do I need to write in the ajax.php file so that when the ask button is pressed, answers to questions are displayed like here html
<div style='margin: auto; width: 480px; padding-top: 10px'>
<input type='text' id='question' name='question' class='numerologiya_input' placeholder='Введите вопрос'/>
<div class='sendquestion' style='width: 193px; height: 82px; margin: auto; background: url(/images/sprosit.png); cursor: pointer'></div>
</div>
<script>
$('.sendquestion').click(function(){
if( $('input[name=question]').val()=='' )
{
$('#answer').html('Зачем беспокоить шар по пустякам?').fadeIn(1500).fadeOut(1000);
}
else
{
$('#answer').hide();
$.ajax({
url: '/ajax.php',
type: 'POST',
data: {
'question': $('#question').val()
},
success: function(html){
$('#answer').html(html);
$('#answer').fadeIn(1500);
}
});
}
});
</script>
Answer the question
In order to leave comments, you need to log in
$arrAnswer = [
'Твой разум затуманен',
'Никто не будет писать за тебя весь код',
'Возможно, стоит поднять свой скилл',
'Не огорчайся, можно спать и 2 часа в день',
'Это пройдёт',
];
return $arrAnswer[rand(0,4)];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question