Answer the question
In order to leave comments, you need to log in
Undefined index error in Ajax?
Good evening, there is such an Ajax
$(function(){
$("#send").click(function(){
var title = $("#title").val();
var color = $("#color").val();
var project = $("#project").val();
var shorttext = $("#shorttext").val();
var task = $("#task").val();
$.ajax({
type: "POST",
url: "includes/tasks.php",
data: {"title": title, "color": color,"project": project,"shorttext": shorttext,"task": task,},
cache: false,
success: function(response){
var messageResp = new Array('Ваше сообщение отправлено','Сообщение не отправлено Ошибка базы данных','Нельзя отправлять пустые сообщения');
var resultStat = messageResp[Number(response)];
if(response == 0){
$("#title").val("");
$("#shorttext").val("");
$("#color").val("");
$("#project").val("");
$("#task").val("");
}
$("#resp").text(resultStat).show().delay(1500).fadeOut(800);
}
});
return false;
});
});
if(empty($_POST['js'])){
if($_POST['title'] != '' && $_POST['task'] != '' && $_POST['shorttext'] != '' && $_POST['color'] != '' && $_POST['project'] != ''){
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question